Re: [PATCH] fs: Use KMEM_CACHE instead of kmem_cache_create
From: Jan Kara
Date: Wed Jan 31 2024 - 06:19:15 EST
On Wed 31-01-24 15:09:41, Kunwu Chan wrote:
> commit 0a31bd5f2bbb ("KMEM_CACHE(): simplify slab cache creation")
> introduces a new macro.
> 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@xxxxxxxxxx>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
> ---
> fs/backing-file.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/backing-file.c b/fs/backing-file.c
> index a681f38d84d8..740185198db3 100644
> --- a/fs/backing-file.c
> +++ b/fs/backing-file.c
> @@ -325,9 +325,7 @@ EXPORT_SYMBOL_GPL(backing_file_mmap);
>
> static int __init backing_aio_init(void)
> {
> - backing_aio_cachep = kmem_cache_create("backing_aio",
> - sizeof(struct backing_aio),
> - 0, SLAB_HWCACHE_ALIGN, NULL);
> + backing_aio_cachep = KMEM_CACHE(backing_aio, SLAB_HWCACHE_ALIGN);
> if (!backing_aio_cachep)
> return -ENOMEM;
>
> --
> 2.39.2
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR