Whamcloud - gitweb
tune2fs: only set the superblock as dirty if the default group is modified
authorGwendal Grignou <gwendal@chromium.org>
Thu, 18 Jul 2024 17:52:04 +0000 (10:52 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 25 Oct 2024 02:07:55 +0000 (22:07 -0400)
Similar to commit 2eb3b20e80, it speeds up `tunefs -g` command when
the group argument is identical.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20240718175204.1590917-1-gwendal@chromium.org
misc/tune2fs.c

index 6de40e9..49772d3 100644 (file)
@@ -3381,9 +3381,13 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
                printf(_("Setting error behavior to %d\n"), errors);
        }
        if (g_flag) {
-               sb->s_def_resgid = resgid;
-               ext2fs_mark_super_dirty(fs);
-               printf(_("Setting reserved blocks gid to %lu\n"), resgid);
+               if (sb->s_def_resgid != resgid) {
+                       sb->s_def_resgid = resgid;
+                       ext2fs_mark_super_dirty(fs);
+                       printf(_("Setting reserved blocks gid to %lu\n"), resgid);
+               } else {
+                       printf(_("Reserved blocks gid already set to %lu\n"), resgid);
+               }
        }
        if (i_flag) {
                if ((unsigned long long)interval >= (1ULL << 32)) {