]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs/ntfs3: Optimization in ntfs_set_state()
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Mon, 16 Jan 2023 10:23:38 +0000 (14:23 +0400)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Mon, 27 Mar 2023 12:59:19 +0000 (16:59 +0400)
The current volume flags are updated only if VOLUME_FLAG_DIRTY has been changed.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/fsntfs.c

index 342938704cfd9bf9e5f503148463715f8913d681..d888ba14237f47bfd483a6d3937220ee22a5e280 100644 (file)
@@ -925,6 +925,7 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty)
        struct VOLUME_INFO *info;
        struct mft_inode *mi;
        struct ntfs_inode *ni;
+       __le16 info_flags;
 
        /*
         * 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)
                goto out;
        }
 
+       info_flags = info->flags;
+
        switch (dirty) {
        case NTFS_DIRTY_ERROR:
                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)
                break;
        }
        /* Cache current volume flags. */
-       sbi->volume.flags = info->flags;
-       mi->dirty = true;
+       if (info_flags != info->flags) {
+               sbi->volume.flags = info->flags;
+               mi->dirty = true;
+       }
        err = 0;
 
 out: