[PATCH 4/6] btrfs: Simplify the allocation of slab caches in btrfs_ctree_init

From: Kunwu Chan
Date: Tue Feb 20 2024 - 04:09:16 EST


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>
---
fs/btrfs/ctree.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 33145da449cc..cb9e79eb6140 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -5082,9 +5082,7 @@ int btrfs_previous_extent_item(struct btrfs_root *root,

int __init btrfs_ctree_init(void)
{
- btrfs_path_cachep = kmem_cache_create("btrfs_path",
- sizeof(struct btrfs_path), 0,
- SLAB_MEM_SPREAD, NULL);
+ btrfs_path_cachep = KMEM_CACHE(btrfs_path, SLAB_MEM_SPREAD);
if (!btrfs_path_cachep)
return -ENOMEM;
return 0;
--
2.39.2