Whamcloud - gitweb
libext2fs: use ext2fs_group_first_block() instead of open-coded equivalent
authorValerie Clement <valerie.clement@bull.net>
Thu, 30 Aug 2007 15:31:36 +0000 (17:31 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 14 Oct 2007 22:52:01 +0000 (18:52 -0400)
Use ext2fs_group_first_block() instead of the open-coded equivalent in
ext2fs_super_and_bgd_loc() and ext2fs_descriptor_block_loc().

Signed-off-by: Valerie Clement <valerie.clement@bull.net>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/closefs.c
lib/ext2fs/openfs.c

index c570256..64f010e 100644 (file)
@@ -57,8 +57,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs,
        int     numblocks, has_super;
        int     old_desc_blocks;
 
-       group_block = fs->super->s_first_data_block +
-               (group * fs->super->s_blocks_per_group);
+       group_block = ext2fs_group_first_block(fs, group);
 
        if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
                old_desc_blocks = fs->super->s_first_meta_bg;
index 35bd44b..2cc0336 100644 (file)
@@ -42,8 +42,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i)
        bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i;
        if (ext2fs_bg_has_super(fs, bg))
                has_super = 1;
-       ret_blk = (fs->super->s_first_data_block + has_super + 
-                  (bg * fs->super->s_blocks_per_group));
+       ret_blk = ext2fs_group_first_block(fs, bg) + has_super;
        /*
         * If group_block is not the normal value, we're trying to use
         * the backup group descriptors and superblock --- so use the