Skip to content

Commit

Permalink
ext4: improve ext4_fill_flex_info() a bit
Browse files Browse the repository at this point in the history
- use kzalloc() instead of kmalloc() + memset()
- improve a printk info

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Li Zefan authored and Theodore Ts'o committed Jul 24, 2008
1 parent 12219ae commit ec05e86
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1506,14 +1506,13 @@ static int ext4_fill_flex_info(struct super_block *sb)

flex_group_count = (sbi->s_groups_count + groups_per_flex - 1) /
groups_per_flex;
sbi->s_flex_groups = kmalloc(flex_group_count *
sbi->s_flex_groups = kzalloc(flex_group_count *
sizeof(struct flex_groups), GFP_KERNEL);
if (sbi->s_flex_groups == NULL) {
printk(KERN_ERR "EXT4-fs: not enough memory\n");
printk(KERN_ERR "EXT4-fs: not enough memory for "
"%lu flex groups\n", flex_group_count);
goto failed;
}
memset(sbi->s_flex_groups, 0, flex_group_count *
sizeof(struct flex_groups));

gdp = ext4_get_group_desc(sb, 1, &bh);
block_bitmap = ext4_block_bitmap(sb, gdp) - 1;
Expand Down

0 comments on commit ec05e86

Please sign in to comment.