[vz7,v2] fs/ext4: Replace ext4_kv?alloc() with kv?alloc() where possible

Submitted by Oleg Babin on March 21, 2018, 4:32 p.m.

Details

Message ID 1521649927-177565-1-git-send-email-obabin@virtuozzo.com
State New
Series "fs/ext4: Replace ext4_kv?alloc() with kv?alloc() where possible"
Headers show

Commit Message

Oleg Babin March 21, 2018, 4:32 p.m.
Replace ext4_kv?alloc() with kv?alloc() in all places where it is
invoked with GFP_KERNEL flag.

There are two places where ext4_kvmalloc() is invoked with GFP_NOFS
flag, those cases should be investigated separately.

https://jira.sw.ru/browse/PSBM-82549
Signed-off-by: Oleg Babin <obabin@virtuozzo.com>
---
 fs/ext4/mballoc.c | 2 +-
 fs/ext4/super.c   | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index cee4c7e..b3ddecb 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2350,7 +2350,7 @@  int ext4_mb_alloc_groupinfo(struct super_block *sb, ext4_group_t ngroups)
 		return 0;
 
 	size = roundup_pow_of_two(sizeof(*sbi->s_group_info) * size);
-	new_groupinfo = ext4_kvzalloc(size, GFP_KERNEL);
+	new_groupinfo = kvzalloc(size, GFP_KERNEL);
 	if (!new_groupinfo) {
 		ext4_msg(sb, KERN_ERR, "can't allocate buddy meta group");
 		return -ENOMEM;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c1e7ad7..3270969 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2181,7 +2181,7 @@  int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup)
 		return 0;
 
 	size = roundup_pow_of_two(size * sizeof(struct flex_groups));
-	new_groups = ext4_kvzalloc(size, GFP_KERNEL);
+	new_groups = kvzalloc(size, GFP_KERNEL);
 	if (!new_groups) {
 		ext4_msg(sb, KERN_ERR, "not enough memory for %d flex groups",
 			 size / (int) sizeof(struct flex_groups));
@@ -4310,9 +4310,8 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 			goto failed_mount;
 		}
 	}
-	sbi->s_group_desc = ext4_kvmalloc(db_count *
-					  sizeof(struct buffer_head *),
-					  GFP_KERNEL);
+	sbi->s_group_desc = kvmalloc(db_count * sizeof(struct buffer_head *),
+				     GFP_KERNEL);
 	if (sbi->s_group_desc == NULL) {
 		ext4_msg(sb, KERN_ERR, "not enough memory");
 		ret = -ENOMEM;

Comments

Andrey Ryabinin March 21, 2018, 5:02 p.m.
On 03/21/2018 07:32 PM, Oleg Babin wrote:
> Replace ext4_kv?alloc() with kv?alloc() in all places where it is
> invoked with GFP_KERNEL flag.
> 
> There are two places where ext4_kvmalloc() is invoked with GFP_NOFS
> flag, those cases should be investigated separately.
> 
> https://jira.sw.ru/browse/PSBM-82549
> Signed-off-by: Oleg Babin <obabin@virtuozzo.com>

Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>