From: Kunwu Chan <chentao@kylinos.cn>
To: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Kunwu Chan <chentao@kylinos.cn>
Subject: [PATCH 1/6] btrfs: Simplify the allocation of slab caches in btrfs_delayed_inode_init
Date: Tue, 20 Feb 2024 17:06:40 +0800 [thread overview]
Message-ID: <20240220090645.108625-2-chentao@kylinos.cn> (raw)
In-Reply-To: <20240220090645.108625-1-chentao@kylinos.cn>
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Make the code cleaner and more readable.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
fs/btrfs/delayed-inode.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 08102883f560..8c748c6cdf6d 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -28,11 +28,7 @@ static struct kmem_cache *delayed_node_cache;
int __init btrfs_delayed_inode_init(void)
{
- delayed_node_cache = kmem_cache_create("btrfs_delayed_node",
- sizeof(struct btrfs_delayed_node),
- 0,
- SLAB_MEM_SPREAD,
- NULL);
+ delayed_node_cache = KMEM_CACHE(btrfs_delayed_node, SLAB_MEM_SPREAD);
if (!delayed_node_cache)
return -ENOMEM;
return 0;
--
2.39.2
next prev parent reply other threads:[~2024-02-20 9:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 9:06 [PATCH 0/6] btrfs: Use KMEM_CACHE instead of kmem_cache_create Kunwu Chan
2024-02-20 9:06 ` Kunwu Chan [this message]
2024-02-20 9:06 ` [PATCH 2/6] btrfs: Simplify the allocation of slab caches in ordered_data_init Kunwu Chan
2024-02-20 9:06 ` [PATCH 3/6] btrfs: Simplify the allocation of slab caches in btrfs_transaction_init Kunwu Chan
2024-02-20 9:06 ` [PATCH 4/6] btrfs: Simplify the allocation of slab caches in btrfs_ctree_init Kunwu Chan
2024-02-20 9:06 ` [PATCH 5/6] btrfs: Simplify the allocation of slab caches in btrfs_delayed_ref_init Kunwu Chan
2024-02-20 9:06 ` [PATCH 6/6] btrfs: Simplify the allocation of slab caches in btrfs_free_space_init Kunwu Chan
2024-02-21 12:00 ` [PATCH 0/6] btrfs: Use KMEM_CACHE instead of kmem_cache_create David Sterba
2024-02-22 3:10 ` Kunwu Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240220090645.108625-2-chentao@kylinos.cn \
--to=chentao@kylinos.cn \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox