diff mbox series

[04/43] xfs: replace kmem_alloc_large() with kvmalloc()

Message ID 163158722190.1604118.5769611604065307959.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfs: sync libxfs with 5.15 | expand

Commit Message

Darrick J. Wong Sept. 14, 2021, 2:40 a.m. UTC
From: Dave Chinner <dchinner@redhat.com>

Source kernel commit: d634525db63e9e946c3229fb93c8d9b763afbaf3

There is no reason for this wrapper existing anymore. All the places
that use KM_NOFS allocation are within transaction contexts and
hence covered by memalloc_nofs_save/restore contexts. Hence we don't
need any special handling of vmalloc for large IOs anymore and
so special casing this code isn't necessary.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 include/kmem.h         |    3 ++-
 libxfs/kmem.c          |    6 ++++--
 libxfs/xfs_attr_leaf.c |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/include/kmem.h b/include/kmem.h
index 383284ea..6d317256 100644
--- a/include/kmem.h
+++ b/include/kmem.h
@@ -22,6 +22,7 @@  typedef unsigned int __bitwise gfp_t;
 #define GFP_KERNEL	((__force gfp_t)0)
 #define GFP_NOFS	((__force gfp_t)0)
 #define __GFP_NOFAIL	((__force gfp_t)0)
+#define __GFP_NOLOCKDEP	((__force gfp_t)0)
 
 #define __GFP_ZERO	(__force gfp_t)1
 
@@ -38,7 +39,7 @@  kmem_cache_free(kmem_zone_t *zone, void *ptr)
 }
 
 extern void	*kmem_alloc(size_t, int);
-extern void	*kmem_alloc_large(size_t, int);
+extern void	*kvmalloc(size_t, gfp_t);
 extern void	*kmem_zalloc(size_t, int);
 
 static inline void
diff --git a/libxfs/kmem.c b/libxfs/kmem.c
index ee50ab66..3d72ac94 100644
--- a/libxfs/kmem.c
+++ b/libxfs/kmem.c
@@ -76,9 +76,11 @@  kmem_alloc(size_t size, int flags)
 }
 
 void *
-kmem_alloc_large(size_t size, int flags)
+kvmalloc(size_t size, gfp_t flags)
 {
-	return kmem_alloc(size, flags);
+	if (flags & __GFP_ZERO)
+		return kmem_zalloc(size, 0);
+	return kmem_alloc(size, 0);
 }
 
 void *
diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c
index cfb6bf17..6499f16f 100644
--- a/libxfs/xfs_attr_leaf.c
+++ b/libxfs/xfs_attr_leaf.c
@@ -486,7 +486,7 @@  xfs_attr_copy_value(
 	}
 
 	if (!args->value) {
-		args->value = kmem_alloc_large(valuelen, KM_NOLOCKDEP);
+		args->value = kvmalloc(valuelen, GFP_KERNEL | __GFP_NOLOCKDEP);
 		if (!args->value)
 			return -ENOMEM;
 	}