Skip to contentSkip to conversation

ext4: improve ext4_fill_flex_info() a bit

PATCH In review Li Zefan 3 participants 3 messages Jul 24, 2008 ext4 file system

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 ext4: improve ext4_fill_flex_info() a bit

- use kzalloc() instead of kmalloc() + memset()
- improve a printk info

---
 fs/ext4/super.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/ext4/super.c +3 -4
index 1cb371d..33eab31 100644
@@ -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;
Signature · 1 line
1.5.4.rc3
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · On Thu, 24 Jul 2008 09:30:20 +0800 Li Zefan <[email protected]> wrote:

- use kzalloc() instead of kmalloc() + memset()
- improve a printk info

Nicer - Thanks

Quoted 28 lines
---
 fs/ext4/super.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/ext4/super.c +3 -4
index 1cb371d..33eab31 100644
@@ -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;
maintainer
#2 lore raw
Quoted 9 lines · Jose R. Santos
Quoted 2 lines · On Thu, 24 Jul 2008 09:30:20 +0800 Li Zefan <[email protected]> wrote:

- use kzalloc() instead of kmalloc() + memset()
- improve a printk info

Nicer - Thanks

I've already merged this into the patch queue earlier today.

- Ted