btrfs: use KMEM_CACHE() to create btrfs_path cache
authorKunwu Chan <chentao@kylinos.cn>
Tue, 20 Feb 2024 09:06:43 +0000 (17:06 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 4 Mar 2024 15:24:53 +0000 (16:24 +0100)
Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify
the creation of SLAB caches when the default values are used.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c

index c878ca466b7c8792bc456f4c2124c0ea0811cfc0..bae17dbe71d692abbfb2a5afe06d11cf187f26dd 100644 (file)
@@ -5086,9 +5086,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;