public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] btrfs: Simplify the allocation of slab caches in btrfs_delayed_inode_init
@ 2024-02-01  8:44 Kunwu Chan
  2024-02-01 13:28 ` [v2] " Markus Elfring
  2024-02-05 16:04 ` [PATCH v2] " David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Kunwu Chan @ 2024-02-01  8:44 UTC (permalink / raw)
  To: clm, josef, dsterba, Johannes.Thumshirn, dsterba
  Cc: linux-btrfs, linux-kernel, Kunwu Chan

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>
---
Changes in v2:
    - Update commit msg only, no functional changes
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-19  9:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-01  8:44 [PATCH v2] btrfs: Simplify the allocation of slab caches in btrfs_delayed_inode_init Kunwu Chan
2024-02-01 13:28 ` [v2] " Markus Elfring
2024-02-05 16:04 ` [PATCH v2] " David Sterba
2024-02-19  9:00   ` Kunwu Chan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox