nfs: use KMEM_CACHE() to create nfs_commit_data cache
Subsystems (2)
PATCH 1/1 nfs: use KMEM_CACHE() to create nfs_commit_data cache
From: Kunwu Chan <[email protected]>
Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify the creation of SLAB caches when the default values are used.
--- fs/nfs/write.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/nfs/write.c +1 -4
@@ -2148,10 +2148,7 @@ int __init nfs_init_writepagecache(void)if (nfs_wdata_mempool ==NULL ) goto out_destroy_write_cache; - nfs_cdata_cachep =kmem_cache_create ("nfs_commit_data" , -sizeof (struct nfs_commit_data ), -0 ,SLAB_HWCACHE_ALIGN , -NULL ); + nfs_cdata_cachep =KMEM_CACHE (nfs_commit_data,SLAB_HWCACHE_ALIGN );if (nfs_cdata_cachep ==NULL ) goto out_destroy_write_mempool;
Signature · 1 line
2.39.2
Quoted 24 lines · On Thu, 2024-02-29 at 17:41 +0800, [email protected] wrote:
From: Kunwu Chan <[email protected]>
Use the
KMEM_CACHE()macro instead ofkmem_cache_create()to simplify the creation of SLAB caches when the default values are used.Signed-off-by Kunwu Chan <[email protected]>---
fs/nfs/write.c | 5 +----1 file changed, 1 insertion(+), 4 deletions(-)fs/nfs/write.c +0
-0@@ -2148,10 +2148,7 @@ int __init nfs_init_writepagecache(void) if (nfs_wdata_mempool == NULL) goto out_destroy_write_cache;fs/nfs/write.c +0
-2- nfs_cdata_cachep = kmem_cache_create("nfs_commit_data", - sizeof(struct
nfs_commit_data),fs/nfs/write.c +1
-2- 0, SLAB_HWCACHE_ALIGN, - NULL); + nfs_cdata_cachep = KMEM_CACHE(nfs_commit_data,
Quoted 3 lines
SLAB_HWCACHE_ALIGN);
if (nfs_cdata_cachep== NULL)
gotoout_destroy_write_mempool;
If this were being done as part of an actual functional code change, then I'd be OK with it, but otherwise it is just unnecessary churn that gets in the way of back porting any future fixes.
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected]
Thanks for the reply.
Quoted 19 lines · Trond Myklebust
Quoted 18 lines · On Thu, 2024-02-29 at 17:41 +0800, [email protected] wrote:
From: Kunwu Chan <[email protected]>
Use the
KMEM_CACHE()macro instead ofkmem_cache_create()to simplify the creation of SLAB caches when the default values are used.Signed-off-by Kunwu Chan <[email protected]>--- fs/nfs/write.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)fs/nfs/write.c +0
-0@@ -2148,10 +2148,7 @@ int __init nfs_init_writepagecache(void) if (nfs_wdata_mempool == NULL) goto out_destroy_write_cache;
Quoted 13 lines
Quoted 9 lines
fs/nfs/write.c +1
-4- nfs_cdata_cachep =kmem_cache_create ("nfs_commit_data" , - sizeof(struct nfs_commit_data), - 0, SLAB_HWCACHE_ALIGN, - NULL); + nfs_cdata_cachep =KMEM_CACHE (nfs_commit_data,SLAB_HWCACHE_ALIGN ); if (nfs_cdata_cachep == NULL)goto
out_destroy_write_mempool;If this were being done as part of an actual functional code change, then I'd be OK with it, but otherwise it is just unnecessary churn that gets in the way of back porting any future fixes.
It's just my personal opinion, I meant to do some cleanup. It's not entirely necessary either, as everyone prefers a different style of code. It doesn't matter.
Quoted 2 lines
Signature · 2 lines
Thanks, Kunwu