Skip to content

Commit 6256024

Browse files
fs/ntfs3: Optimization in ntfs_set_state()
The current volume flags are updated only if VOLUME_FLAG_DIRTY has been changed. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent 1842fbc commit 6256024

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

fs/ntfs3/fsntfs.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,7 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty)
925925
struct VOLUME_INFO *info;
926926
struct mft_inode *mi;
927927
struct ntfs_inode *ni;
928+
__le16 info_flags;
928929

929930
/*
930931
* Do not change state if fs was real_dirty.
@@ -957,6 +958,8 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty)
957958
goto out;
958959
}
959960

961+
info_flags = info->flags;
962+
960963
switch (dirty) {
961964
case NTFS_DIRTY_ERROR:
962965
ntfs_notice(sbi->sb, "Mark volume as dirty due to NTFS errors");
@@ -970,8 +973,10 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty)
970973
break;
971974
}
972975
/* Cache current volume flags. */
973-
sbi->volume.flags = info->flags;
974-
mi->dirty = true;
976+
if (info_flags != info->flags) {
977+
sbi->volume.flags = info->flags;
978+
mi->dirty = true;
979+
}
975980
err = 0;
976981

977982
out:

0 commit comments

Comments
 (0)