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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Mar 22 13:32:44 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.45.8
------>
commit 254410368562e266e40d46ad3bac3666777ba884
Author: Oleg Babin <obabin at virtuozzo.com>
Date:   Thu Mar 22 13:32:44 2018 +0300

    fs/ext4: Replace ext4_kv?alloc() with kv?alloc() where possible
    
    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>
    Reviewed-by: Andrey Ryabinin <aryabinin 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 cee4c7e5048a..b3ddecb62ded 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 c1e7ad7e3271..32709698fb23 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;


More information about the Devel mailing list