From: Gwendal Grignou Date: Thu, 18 Jul 2024 17:52:04 +0000 (-0700) Subject: tune2fs: only set the superblock as dirty if the default group is modified X-Git-Tag: v1.47.2-wc1~154 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=2c1e5543169254863e0edc40bd35712e21073479;p=tools%2Fe2fsprogs.git tune2fs: only set the superblock as dirty if the default group is modified Similar to commit 2eb3b20e80, it speeds up `tunefs -g` command when the group argument is identical. Signed-off-by: Theodore Ts'o Link: https://lore.kernel.org/r/20240718175204.1590917-1-gwendal@chromium.org --- diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 6de40e9..49772d3 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -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)) {