Skip to content

Commit ec05e86

Browse files
Li Zefantytso
authored andcommitted
ext4: improve ext4_fill_flex_info() a bit
- 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>
1 parent 12219ae commit ec05e86

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎fs/ext4/super.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,14 +1506,13 @@ static int ext4_fill_flex_info(struct super_block *sb)
15061506

15071507
flex_group_count = (sbi->s_groups_count + groups_per_flex - 1) /
15081508
groups_per_flex;
1509-
sbi->s_flex_groups = kmalloc(flex_group_count *
1509+
sbi->s_flex_groups = kzalloc(flex_group_count *
15101510
sizeof(struct flex_groups), GFP_KERNEL);
15111511
if (sbi->s_flex_groups == NULL) {
1512-
printk(KERN_ERR "EXT4-fs: not enough memory\n");
1512+
printk(KERN_ERR "EXT4-fs: not enough memory for "
1513+
"%lu flex groups\n", flex_group_count);
15131514
goto failed;
15141515
}
1515-
memset(sbi->s_flex_groups, 0, flex_group_count *
1516-
sizeof(struct flex_groups));
15171516

15181517
gdp = ext4_get_group_desc(sb, 1, &bh);
15191518
block_bitmap = ext4_block_bitmap(sb, gdp) - 1;

0 commit comments

Comments
 (0)