Allow tune2fs -I if only one group per flex
PATCH v2 1/1 Allow tune2fs -I if only one group per flex
This can be caused by tune2fs -O flex_bg.
And tune2fs -I should work okay if bitmaps and inode tables are still within the group.
Signed-off-by Peng Tao <[email protected]>
--- lib/ext2fs/check_desc.c | 12 +++++++++--- lib/ext2fs/ext2fs.h | 1 + misc/tune2fs.c | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-)
lib/ext2fs/check_desc.c +9 -3
@@ -26,10 +26,17 @@#include "ext2_fs.h" #include "ext2fs.h" +errcode_t ext2fs_check_desc (ext2_filsys fs) +{ +return ext2fs_check_desc_sanity (fs, + !EXT2_HAS_INCOMPAT_FEATURE (fs->super, +EXT4_FEATURE_INCOMPAT_FLEX_BG )); +} +/* * This routine sanity checks the group descriptors */ -errcode_t ext2fs_check_desc (ext2_filsys fs) +errcode_t ext2fs_check_desc_sanity (ext2_filsys fs,int within_group) {ext2fs_block_bitmap bmap;errcode_t retval;
@@ -49,8 +56,7 @@ errcode_t ext2fs_check_desc(ext2_filsys fs)ext2fs_reserve_super_and_bgd (fs, i, bmap);for (i =0 ; i < fs->group_desc_count; i++) { -if (!EXT2_HAS_INCOMPAT_FEATURE (fs->super, -EXT4_FEATURE_INCOMPAT_FLEX_BG )) { +if (within_group) { first_block =ext2fs_group_first_block (fs, i); last_block =ext2fs_group_last_block (fs, i);if (i == (fs->group_desc_count -1 ))
lib/ext2fs/ext2fs.h +1 -0
@@ -724,6 +724,7 @@ extern errcode_t ext2fs_move_blocks(ext2_filsys fs,/* check_desc.c */ extern errcode_t ext2fs_check_desc (ext2_filsys fs); +extern errcode_t ext2fs_check_desc_sanity (ext2_filsys fs,int within_group);/* closefs.c */ extern errcode_t ext2fs_close (ext2_filsys fs);
misc/tune2fs.c +2 -1
@@ -1715,7 +1715,8 @@ retry_open:exit (1 ); }if (fs->super->s_feature_incompat & -EXT4_FEATURE_INCOMPAT_FLEX_BG ) { +EXT4_FEATURE_INCOMPAT_FLEX_BG && +ext2fs_check_desc_sanity (fs,1 )) { fputs(_("Changing the inode size not supported for " "filesystems with the flex_bg\n" "feature enabled.\n"),
Signature · 1 line
1.6.1.3