From ff662d5dbf95f2e68eed6f6b6a4e10307a7d13bd Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 28 Feb 2008 21:26:01 -0500 Subject: [PATCH] tune2fs: Remove support for clearing the SPARSE_SUPER feature Clearing SPARSE_SUPER is dangerous; it can result in a filesystem which e2fsck can't fix easily. Since there is very few good reasons for wanting to turn this feature off, disable tune2fs's abiity to do this. Users who really want this can use debugfs. Also, deprecate the tune2fs -s option. Remove it from the man page and usage message. Addresses-Sourceforge-Bug: #1840286 Signed-off-by: "Theodore Ts'o" --- misc/tune2fs.8.in | 6 ------ misc/tune2fs.c | 30 ++++++++++-------------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in index ff8ae48..8b59c17 100644 --- a/misc/tune2fs.8.in +++ b/misc/tune2fs.8.in @@ -461,12 +461,6 @@ can be run to convert existing directories to the hashed B-tree format. .BI \-r " reserved-blocks-count" Set the number of reserved filesystem blocks. .TP -.BR \-s " [" 0 | 1 ] -Turn the sparse super feature off or on. Turning this feature on -saves space on really big filesystems. This is the same as using the -.B "\-O sparse_super" -option. -.TP .BI \-T " time-last-checked" Set the time the filesystem was last checked using .BR e2fsck . diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 184b5d6..4f66d42 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -97,10 +97,11 @@ static void usage(void) fprintf(stderr, _("Usage: %s [-c max_mounts_count] [-e errors_behavior] " "[-g group]\n" - "\t[-i interval[d|m|w]] [-j] [-J journal_options]\n" - "\t[-l] [-s sparse_flag] [-m reserved_blocks_percent]\n" - "\t[-o [^]mount_options[,...]] [-r reserved_blocks_count]\n" - "\t[-u user] [-C mount_count] [-L volume_label]\n" + "\t[-i interval[d|m|w]] [-j] [-J journal_options] [-l]\n" + "\t[-m reserved_blocks_percent] " + "[-o [^]mount_options[,...]] \n" + "\t[-r reserved_blocks_count] [-u user] [-C mount_count] " + "[-L volume_label]\n" "\t[-M last_mounted_dir] [-O [^]feature[,...]]\n" "\t[-E extended-option[,...]] [-T last_check_time] " "[-U UUID] device\n"), program_name); @@ -126,8 +127,7 @@ static __u32 clear_ok_features[3] = { /* Incompat */ EXT2_FEATURE_INCOMPAT_FILETYPE, /* R/O compat */ - EXT2_FEATURE_RO_COMPAT_LARGE_FILE | - EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER + EXT2_FEATURE_RO_COMPAT_LARGE_FILE }; /* @@ -719,7 +719,7 @@ static void parse_tune2fs_options(int argc, char **argv) r_flag = 1; open_flag = EXT2_FLAG_RW; break; - case 's': + case 's': /* Deprecated */ s_flag = atoi(optarg); open_flag = EXT2_FLAG_RW; break; @@ -1005,19 +1005,9 @@ int main (int argc, char ** argv) } } if (s_flag == 0) { - if (!(sb->s_feature_ro_compat & - EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) - fputs(_("\nThe filesystem already has sparse " - "superblocks disabled.\n"), stderr); - else { - sb->s_feature_ro_compat &= - ~EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER; - sb->s_state &= ~EXT2_VALID_FS; - fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; - ext2fs_mark_super_dirty(fs); - printf(_("\nSparse superblock flag cleared. %s"), - _(please_fsck)); - } + fputs(_("\nClearing the sparse superflag not supported.\n"), + stderr); + exit(1); } if (T_flag) { sb->s_lastcheck = last_check_time; -- 1.8.3.1