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 <tytso@mit.edu>
Link: https://lore.kernel.org/r/20240718175204.1590917-1-gwendal@chromium.org
This commit is contained in:
Gwendal Grignou 2024-07-18 10:52:04 -07:00 committed by Theodore Ts'o
parent 9448aedd93
commit 2c1e554316

View 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)) {