ext2fs_open_inode_scan: Handle an non-zero bg_itable_used in block group 0

Previously, the portion of the inode table for block group 0 was
always completely zero'ed out, so the ext2fs_open_inode_scan() didn't
handle a non-zero bg_itable_used value for the first block group.  Fix
this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize
Theodore Ts'o 2008-04-22 23:22:17 -04:00
parent 0f2794c020
commit d11736c6dd
1 changed files with 9 additions and 0 deletions

View File

@ -146,6 +146,15 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
group_desc[scan->current_group].bg_inode_table;
scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super);
scan->blocks_left = scan->fs->inode_blocks_per_group;
if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
scan->inodes_left -=
fs->group_desc[scan->current_group].bg_itable_unused;
scan->blocks_left =
(scan->inodes_left +
(fs->blocksize / scan->inode_size - 1)) *
scan->inode_size / fs->blocksize;
}
retval = ext2fs_get_array(scan->inode_buffer_blocks,
fs->blocksize,
&scan->inode_buffer);