OSDN Git Service

Relax group descriptor checking for FLEX_BG
authorJose R. Santos <jrs@us.ibm.com>
Tue, 14 Aug 2007 04:33:03 +0000 (23:33 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 4 Nov 2007 00:13:16 +0000 (20:13 -0400)
The FLEX_BG feature allows the inode table, block bitmap, and inode
bitmaps to be located anywhere in the filesystem.  Update e2fsck and
libext2fs's checking code to recognize this.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
--

 e2fsck/super.c          |   14 ++++++++++++--
 lib/ext2fs/check_desc.c |   15 +++++++++++++--
 2 files changed, 25 insertions(+), 4 deletions(-)

e2fsck/super.c
lib/ext2fs/check_desc.c

index e3943cb..dbd7b1a 100644 (file)
@@ -575,13 +575,17 @@ void check_super_block(e2fsck_t ctx)
        /*
         * Verify the group descriptors....
         */
-       first_block =  sb->s_first_data_block;
+       first_block = sb->s_first_data_block;
+       last_block = sb->s_blocks_count-1;
 
        for (i = 0, gd=fs->group_desc; i < fs->group_desc_count; i++, gd++) {
                pctx.group = i;
 
-               first_block = ext2fs_group_first_block(fs, i);
-               last_block = ext2fs_group_last_block(fs, i);
+               if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+                                              EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
+                       first_block = ext2fs_group_first_block(fs, i);
+                       last_block = ext2fs_group_last_block(fs, i);
+               }
 
                if ((gd->bg_block_bitmap < first_block) ||
                    (gd->bg_block_bitmap > last_block)) {
index 146f9e5..900b179 100644 (file)
@@ -33,13 +33,16 @@ errcode_t ext2fs_check_desc(ext2_filsys fs)
 {
        dgrp_t i;
        blk_t first_block = fs->super->s_first_data_block;
-       blk_t last_block;
+       blk_t last_block = fs->super->s_blocks_count-1;
 
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
        for (i = 0; i < fs->group_desc_count; i++) {
-               first_block = ext2fs_group_first_block(fs, i);
-               last_block = ext2fs_group_last_block(fs, i);
+               if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+                                              EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
+                       first_block = ext2fs_group_first_block(fs, i);
+                       last_block = ext2fs_group_last_block(fs, i);
+               }
 
                /*
                 * Check to make sure block bitmap for group is