提交 ec05e868 编写于 作者: L Li Zefan 提交者: Theodore Ts'o

ext4: improve ext4_fill_flex_info() a bit

- use kzalloc() instead of kmalloc() + memset()
- improve a printk info
Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
上级 12219aea
...@@ -1506,14 +1506,13 @@ static int ext4_fill_flex_info(struct super_block *sb) ...@@ -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) / flex_group_count = (sbi->s_groups_count + groups_per_flex - 1) /
groups_per_flex; 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); sizeof(struct flex_groups), GFP_KERNEL);
if (sbi->s_flex_groups == NULL) { 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; goto failed;
} }
memset(sbi->s_flex_groups, 0, flex_group_count *
sizeof(struct flex_groups));
gdp = ext4_get_group_desc(sb, 1, &bh); gdp = ext4_get_group_desc(sb, 1, &bh);
block_bitmap = ext4_block_bitmap(sb, gdp) - 1; block_bitmap = ext4_block_bitmap(sb, gdp) - 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册