Skip to content

Commit

Permalink
tune2fs: enable uninit_bg when disabling metadata_csum
Browse files Browse the repository at this point in the history
If we're disabling metadata_csum and the user doesn't provide explicit
instructions to enable or disable uninit_bg, assume that they want
uninit_bg to be turned on by default.  Otherwise, we lose all block
group flags and unused inode count, which is a big hit to performance.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
djwong authored and tytso committed Dec 14, 2014
1 parent a742a12 commit 052795e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions misc/tune2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,12 +1141,26 @@ static int update_feature_set(ext2_filsys fs, char *features)

if (FEATURE_OFF(E2P_FEATURE_RO_INCOMPAT,
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
__u32 test_features[3];

if (check_fsck_needed(fs))
exit(1);
if (mount_flags & EXT2_MF_MOUNTED)
fputs(_("Cannot disable metadata_csum on a mounted "
"filesystem!\n"), stderr);
rewrite_checksums = 1;

/* Enable uninit_bg unless the user expressly turned it off */
memcpy(test_features, old_features, sizeof(test_features));
test_features[E2P_FEATURE_RO_INCOMPAT] |=
EXT4_FEATURE_RO_COMPAT_GDT_CSUM;
e2p_edit_feature2(features, test_features, ok_features,
clear_ok_features, NULL, NULL);
if (test_features[E2P_FEATURE_RO_INCOMPAT] &
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
fs->super->s_feature_ro_compat |=
EXT4_FEATURE_RO_COMPAT_GDT_CSUM;

/*
* If we're turning off metadata_csum and not turning on
* uninit_bg, rewrite group desc.
Expand Down

0 comments on commit 052795e

Please sign in to comment.