diff mbox series

fs: Use KMEM_CACHE instead of kmem_cache_create

Message ID 20240131070941.135178-1-chentao@kylinos.cn (mailing list archive)
State New
Headers show
Series fs: Use KMEM_CACHE instead of kmem_cache_create | expand

Commit Message

Kunwu Chan Jan. 31, 2024, 7:09 a.m. UTC
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@kylinos.cn>
---
 fs/backing-file.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jan Kara Jan. 31, 2024, 11:18 a.m. UTC | #1
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@kylinos.cn>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								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
>
Christian Brauner Jan. 31, 2024, 1:39 p.m. UTC | #2
On Wed, 31 Jan 2024 15:09:41 +0800, 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.
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] fs: Use KMEM_CACHE instead of kmem_cache_create
      https://git.kernel.org/vfs/vfs/c/6f351af0c85f
diff mbox series

Patch

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;