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

Oleg Babin obabin at virtuozzo.com
Wed Mar 21 19:32:07 MSK 2018


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 at virtuozzo.com>
---
 fs/ext4/mballoc.c | 2 +-
 fs/ext4/super.c   | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

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;
-- 
1.8.3.1



More information about the Devel mailing list