[Devel] [PATCH RHEL8 COMMIT] ext4: kill ext4_kv[mz]alloc()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 7 16:37:17 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.35
------>
commit b50724e17d9cc80235a55cdee8077ec6858335ad
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date:   Mon Jun 7 16:37:17 2021 +0300

    ext4: kill ext4_kv[mz]alloc()
    
    https://jira.sw.ru/browse/PSBM-83044
    
    Signed-off-by: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
    
    (cherry-picked from aaeefcf3bf669b93f125c1365ca0e9754791bd44)
    +++
    ext4: drop ext4_kvmalloc()
    
    As Jan pointed out[1], as of commit 81378da64de ("jbd2: mark the
    transaction context with the scope GFP_NOFS context") we use
    memalloc_nofs_{save,restore}() while a jbd2 handle is active.  So
    ext4_kvmalloc() so we can call allocate using GFP_NOFS is no longer
    necessary.
    
    [1] https://lore.kernel.org/r/20200109100007.GC27035@quack2.suse.cz
    
    Signed-off-by: Theodore Ts'o <tytso at mit.edu>
    Link: https://lore.kernel.org/r/20200116155031.266620-1-tytso@mit.edu
    Reviewed-by: Jan Kara <jack at suse.cz>
    
    (cherry-picked from ms commit 71b565ceff37 ("ext4: drop ext4_kvmalloc()"))
    
    (last patch is taken from ms to remove leftover ext4_kvmalloc from
    fs/ext4/xattr.c)
    https://jira.sw.ru/browse/PSBM-127849
    
    Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
 fs/ext4/super.c | 20 --------------------
 fs/ext4/xattr.c |  2 +-
 2 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index fe52b83fabd8..5398e022f088 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -204,26 +204,6 @@ void ext4_superblock_csum_set(struct super_block *sb)
 	es->s_checksum = ext4_superblock_csum(sb, es);
 }
 
-void *ext4_kvmalloc(size_t size, gfp_t flags)
-{
-	void *ret;
-
-	ret = kmalloc(size, flags | __GFP_NOWARN);
-	if (!ret)
-		ret = __vmalloc(size, flags, PAGE_KERNEL);
-	return ret;
-}
-
-void *ext4_kvzalloc(size_t size, gfp_t flags)
-{
-	void *ret;
-
-	ret = kzalloc(size, flags | __GFP_NOWARN);
-	if (!ret)
-		ret = __vmalloc(size, flags | __GFP_ZERO, PAGE_KERNEL);
-	return ret;
-}
-
 ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
 			       struct ext4_group_desc *bg)
 {
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 6d12ac4a814e..9b29a40738ac 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1458,7 +1458,7 @@ ext4_xattr_inode_cache_find(struct inode *inode, const void *value,
 	if (!ce)
 		return NULL;
 
-	ea_data = ext4_kvmalloc(value_len, GFP_NOFS);
+	ea_data = kvmalloc(value_len, GFP_KERNEL);
 	if (!ea_data) {
 		mb_cache_entry_put(ea_inode_cache, ce);
 		return NULL;


More information about the Devel mailing list