[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240220090645.108625-6-chentao@kylinos.cn>
Date: Tue, 20 Feb 2024 17:06:44 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: clm@...com,
josef@...icpanda.com,
dsterba@...e.com
Cc: linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH 5/6] btrfs: Simplify the allocation of slab caches in btrfs_delayed_ref_init
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@...inos.cn>
---
fs/btrfs/delayed-ref.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 891ea2fa263c..4a352e00ffde 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -1242,31 +1242,23 @@ void __cold btrfs_delayed_ref_exit(void)
int __init btrfs_delayed_ref_init(void)
{
- btrfs_delayed_ref_head_cachep = kmem_cache_create(
- "btrfs_delayed_ref_head",
- sizeof(struct btrfs_delayed_ref_head), 0,
- SLAB_MEM_SPREAD, NULL);
+ btrfs_delayed_ref_head_cachep = KMEM_CACHE(btrfs_delayed_ref_head,
+ SLAB_MEM_SPREAD);
if (!btrfs_delayed_ref_head_cachep)
goto fail;
- btrfs_delayed_tree_ref_cachep = kmem_cache_create(
- "btrfs_delayed_tree_ref",
- sizeof(struct btrfs_delayed_tree_ref), 0,
- SLAB_MEM_SPREAD, NULL);
+ btrfs_delayed_tree_ref_cachep = KMEM_CACHE(btrfs_delayed_tree_ref,
+ SLAB_MEM_SPREAD);
if (!btrfs_delayed_tree_ref_cachep)
goto fail;
- btrfs_delayed_data_ref_cachep = kmem_cache_create(
- "btrfs_delayed_data_ref",
- sizeof(struct btrfs_delayed_data_ref), 0,
- SLAB_MEM_SPREAD, NULL);
+ btrfs_delayed_data_ref_cachep = KMEM_CACHE(btrfs_delayed_data_ref,
+ SLAB_MEM_SPREAD);
if (!btrfs_delayed_data_ref_cachep)
goto fail;
- btrfs_delayed_extent_op_cachep = kmem_cache_create(
- "btrfs_delayed_extent_op",
- sizeof(struct btrfs_delayed_extent_op), 0,
- SLAB_MEM_SPREAD, NULL);
+ btrfs_delayed_extent_op_cachep = KMEM_CACHE(btrfs_delayed_extent_op,
+ SLAB_MEM_SPREAD);
if (!btrfs_delayed_extent_op_cachep)
goto fail;
--
2.39.2
Powered by blists - more mailing lists