From: Dave Chinner Date: Mon, 31 Jan 2022 20:25:47 +0000 (-0500) Subject: xfs: replace kmem_alloc_large() with kvmalloc() X-Git-Tag: v5.15.0-rc0~41 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=5cb09fa6457e7ff92e9307e5f9b0c5a09e399609;p=thirdparty%2Fxfsprogs-dev.git xfs: replace kmem_alloc_large() with kvmalloc() 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 Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/include/kmem.h b/include/kmem.h index 383284eaa..6d3172569 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 ee50ab667..3d72ac944 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 cfb6bf171..6499f16f0 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; }