From: Akinobu Mita Date: Fri, 11 Jul 2008 23:27:31 +0000 (-0400) Subject: ext4: fix ext4_init_block_bitmap() for metablock block group X-Git-Tag: MMI-PSA29.97-13-9~33675^2~30 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6afd670713c9e7d5c5550e379dfedca8ffab4c90;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git ext4: fix ext4_init_block_bitmap() for metablock block group When meta_bg feature is enabled and s_first_meta_bg != 0, ext4_init_block_bitmap() miscalculates the number of block used by the group descriptor table (0 or 1 for metablock block group) This patch fixes this by using ext4_bg_num_gdb() Signed-off-by: Akinobu Mita Cc: Andrew Morton Cc: Stephen Tweedie Signed-off-by: Mingming Cao Signed-off-by: "Theodore Ts'o" Acked-by: Andreas Dilger --- diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 6dcbec9b2562..1327ac3a04de 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -121,12 +121,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks); } } else { /* For META_BG_BLOCK_GROUPS */ - int group_rel = (block_group - - le32_to_cpu(sbi->s_es->s_first_meta_bg)) % - EXT4_DESC_PER_BLOCK(sb); - if (group_rel == 0 || group_rel == 1 || - (group_rel == EXT4_DESC_PER_BLOCK(sb) - 1)) - bit_max += 1; + bit_max += ext4_bg_num_gdb(sb, block_group); } if (block_group == sbi->s_groups_count - 1) {