* [PATCH] nfs: use KMEM_CACHE() to create nfs_commit_data cache
@ 2024-02-29 9:41 kunwu.chan
2024-02-29 13:40 ` Trond Myklebust
0 siblings, 1 reply; 3+ messages in thread
From: kunwu.chan @ 2024-02-29 9:41 UTC (permalink / raw)
To: trond.myklebust, anna; +Cc: linux-nfs, linux-kernel, Kunwu Chan
From: Kunwu Chan <chentao@kylinos.cn>
Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify
the creation of SLAB caches when the default values are used.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
fs/nfs/write.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index bb79d3a886ae..6a75772d447f 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -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;
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] nfs: use KMEM_CACHE() to create nfs_commit_data cache
2024-02-29 9:41 [PATCH] nfs: use KMEM_CACHE() to create nfs_commit_data cache kunwu.chan
@ 2024-02-29 13:40 ` Trond Myklebust
2024-03-01 2:06 ` Kunwu Chan
0 siblings, 1 reply; 3+ messages in thread
From: Trond Myklebust @ 2024-02-29 13:40 UTC (permalink / raw)
To: anna@kernel.org, kunwu.chan@linux.dev
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
chentao@kylinos.cn
On Thu, 2024-02-29 at 17:41 +0800, kunwu.chan@linux.dev wrote:
> From: Kunwu Chan <chentao@kylinos.cn>
>
> Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify
> the creation of SLAB caches when the default values are used.
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
> fs/nfs/write.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> index bb79d3a886ae..6a75772d447f 100644
> --- a/fs/nfs/write.c
> +++ b/fs/nfs/write.c
> @@ -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;
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.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] nfs: use KMEM_CACHE() to create nfs_commit_data cache
2024-02-29 13:40 ` Trond Myklebust
@ 2024-03-01 2:06 ` Kunwu Chan
0 siblings, 0 replies; 3+ messages in thread
From: Kunwu Chan @ 2024-03-01 2:06 UTC (permalink / raw)
To: Trond Myklebust, anna@kernel.org, kunwu.chan@linux.dev
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Thanks for the reply.
On 2024/2/29 21:40, Trond Myklebust wrote:
> On Thu, 2024-02-29 at 17:41 +0800, kunwu.chan@linux.dev wrote:
>> From: Kunwu Chan <chentao@kylinos.cn>
>>
>> Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify
>> the creation of SLAB caches when the default values are used.
>>
>> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
>> ---
>> fs/nfs/write.c | 5 +----
>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/fs/nfs/write.c b/fs/nfs/write.c
>> index bb79d3a886ae..6a75772d447f 100644
>> --- a/fs/nfs/write.c
>> +++ b/fs/nfs/write.c
>> @@ -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;
>
> 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.
>
>
--
Thanks,
Kunwu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-01 2:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-29 9:41 [PATCH] nfs: use KMEM_CACHE() to create nfs_commit_data cache kunwu.chan
2024-02-29 13:40 ` Trond Myklebust
2024-03-01 2:06 ` Kunwu Chan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox