* [PATCH] nfsd: Simplify the allocation of slab caches in nfsd_file_cache_init
@ 2024-01-31 6:56 Kunwu Chan
2024-01-31 11:08 ` Jeff Layton
2024-01-31 15:33 ` Chuck Lever
0 siblings, 2 replies; 3+ messages in thread
From: Kunwu Chan @ 2024-01-31 6:56 UTC (permalink / raw)
To: chuck.lever, jlayton, neilb, kolga, Dai.Ngo, tom
Cc: linux-nfs, linux-kernel, Kunwu Chan
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
fs/nfsd/filecache.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 8d9f7b07e35b..f3a642fd0eca 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -722,15 +722,13 @@ nfsd_file_cache_init(void)
return ret;
ret = -ENOMEM;
- nfsd_file_slab = kmem_cache_create("nfsd_file",
- sizeof(struct nfsd_file), 0, 0, NULL);
+ nfsd_file_slab = KMEM_CACHE(nfsd_file, 0);
if (!nfsd_file_slab) {
pr_err("nfsd: unable to create nfsd_file_slab\n");
goto out_err;
}
- nfsd_file_mark_slab = kmem_cache_create("nfsd_file_mark",
- sizeof(struct nfsd_file_mark), 0, 0, NULL);
+ nfsd_file_mark_slab = KMEM_CACHE(nfsd_file_mark, 0);
if (!nfsd_file_mark_slab) {
pr_err("nfsd: unable to create nfsd_file_mark_slab\n");
goto out_err;
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nfsd: Simplify the allocation of slab caches in nfsd_file_cache_init
2024-01-31 6:56 [PATCH] nfsd: Simplify the allocation of slab caches in nfsd_file_cache_init Kunwu Chan
@ 2024-01-31 11:08 ` Jeff Layton
2024-01-31 15:33 ` Chuck Lever
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2024-01-31 11:08 UTC (permalink / raw)
To: Kunwu Chan, chuck.lever, neilb, kolga, Dai.Ngo, tom
Cc: linux-nfs, linux-kernel
On Wed, 2024-01-31 at 14:56 +0800, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
> fs/nfsd/filecache.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 8d9f7b07e35b..f3a642fd0eca 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -722,15 +722,13 @@ nfsd_file_cache_init(void)
> return ret;
>
> ret = -ENOMEM;
> - nfsd_file_slab = kmem_cache_create("nfsd_file",
> - sizeof(struct nfsd_file), 0, 0, NULL);
> + nfsd_file_slab = KMEM_CACHE(nfsd_file, 0);
> if (!nfsd_file_slab) {
> pr_err("nfsd: unable to create nfsd_file_slab\n");
> goto out_err;
> }
>
> - nfsd_file_mark_slab = kmem_cache_create("nfsd_file_mark",
> - sizeof(struct nfsd_file_mark), 0, 0, NULL);
> + nfsd_file_mark_slab = KMEM_CACHE(nfsd_file_mark, 0);
> if (!nfsd_file_mark_slab) {
> pr_err("nfsd: unable to create nfsd_file_mark_slab\n");
> goto out_err;
Sure, I guess:
Acked-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfsd: Simplify the allocation of slab caches in nfsd_file_cache_init
2024-01-31 6:56 [PATCH] nfsd: Simplify the allocation of slab caches in nfsd_file_cache_init Kunwu Chan
2024-01-31 11:08 ` Jeff Layton
@ 2024-01-31 15:33 ` Chuck Lever
1 sibling, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2024-01-31 15:33 UTC (permalink / raw)
To: Kunwu Chan; +Cc: jlayton, neilb, kolga, Dai.Ngo, tom, linux-nfs, linux-kernel
On Wed, Jan 31, 2024 at 02:56:53PM +0800, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
> fs/nfsd/filecache.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 8d9f7b07e35b..f3a642fd0eca 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -722,15 +722,13 @@ nfsd_file_cache_init(void)
> return ret;
>
> ret = -ENOMEM;
> - nfsd_file_slab = kmem_cache_create("nfsd_file",
> - sizeof(struct nfsd_file), 0, 0, NULL);
> + nfsd_file_slab = KMEM_CACHE(nfsd_file, 0);
> if (!nfsd_file_slab) {
> pr_err("nfsd: unable to create nfsd_file_slab\n");
> goto out_err;
> }
>
> - nfsd_file_mark_slab = kmem_cache_create("nfsd_file_mark",
> - sizeof(struct nfsd_file_mark), 0, 0, NULL);
> + nfsd_file_mark_slab = KMEM_CACHE(nfsd_file_mark, 0);
> if (!nfsd_file_mark_slab) {
> pr_err("nfsd: unable to create nfsd_file_mark_slab\n");
> goto out_err;
> --
> 2.39.2
Applied to nfsd-next (for v6.9).
--
Chuck Lever
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-31 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 6:56 [PATCH] nfsd: Simplify the allocation of slab caches in nfsd_file_cache_init Kunwu Chan
2024-01-31 11:08 ` Jeff Layton
2024-01-31 15:33 ` Chuck Lever
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox