Skip to content

Commit

Permalink
ext4: fix uninit block bitmap initialization when s_meta_first_bg is …
Browse files Browse the repository at this point in the history
…non-zero

The number of old-style block group descriptor blocks is
s_meta_first_bg when the meta_bg feature flag is set.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
  • Loading branch information
Theodore Ts'o committed Nov 23, 2009
1 parent 3f8fb94 commit 8dadb19
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/ext4/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,13 @@ static unsigned long ext4_bg_num_gdb_meta(struct super_block *sb,
static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb,
ext4_group_t group)
{
return ext4_bg_has_super(sb, group) ? EXT4_SB(sb)->s_gdb_count : 0;
if (!ext4_bg_has_super(sb, group))
return 0;

if (EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG))
return le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg);
else
return EXT4_SB(sb)->s_gdb_count;
}

/**
Expand Down

0 comments on commit 8dadb19

Please sign in to comment.