mbcache: Simplify the allocation of slab caches

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>
Link: https://lore.kernel.org/r/20240201093426.207932-1-chentao@kylinos.cn
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Kunwu Chan 2024-02-01 17:34:26 +08:00 committed by Christian Brauner
parent 617fc77753
commit ce51bf1790
1 changed files with 2 additions and 3 deletions

View File

@ -426,9 +426,8 @@ EXPORT_SYMBOL(mb_cache_destroy);
static int __init mbcache_init(void)
{
mb_entry_cache = kmem_cache_create("mbcache",
sizeof(struct mb_cache_entry), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL);
mb_entry_cache = KMEM_CACHE(mb_cache_entry,
SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD);
if (!mb_entry_cache)
return -ENOMEM;
return 0;