public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: Simplify the allocation of slab caches in xfs_rmap_intent_init_cache
@ 2024-02-05  8:12 Kunwu Chan
  2024-02-05 10:07 ` Dave Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Kunwu Chan @ 2024-02-05  8:12 UTC (permalink / raw)
  To: chandan.babu, djwong; +Cc: linux-xfs, linux-kernel, Kunwu Chan

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@kylinos.cn>
---
 fs/xfs/libxfs/xfs_rmap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index 76bf7f48cb5a..99aac6f6f6b1 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -2931,9 +2931,7 @@ const struct xfs_owner_info XFS_RMAP_OINFO_COW = {
 int __init
 xfs_rmap_intent_init_cache(void)
 {
-	xfs_rmap_intent_cache = kmem_cache_create("xfs_rmap_intent",
-			sizeof(struct xfs_rmap_intent),
-			0, 0, NULL);
+	xfs_rmap_intent_cache = KMEM_CACHE(xfs_rmap_intent, 0);
 
 	return xfs_rmap_intent_cache != NULL ? 0 : -ENOMEM;
 }
-- 
2.39.2


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

* Re: [PATCH] xfs: Simplify the allocation of slab caches in xfs_rmap_intent_init_cache
  2024-02-05  8:12 [PATCH] xfs: Simplify the allocation of slab caches in xfs_rmap_intent_init_cache Kunwu Chan
@ 2024-02-05 10:07 ` Dave Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2024-02-05 10:07 UTC (permalink / raw)
  To: Kunwu Chan; +Cc: chandan.babu, djwong, linux-xfs, linux-kernel

On Mon, Feb 05, 2024 at 04:12:27PM +0800, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.

What makes you think KMEM_CACHE is new? It was added to the kernel
in 2007 The vast majority of the kernel is still using
kmem_cache_create(), not the weird, shouty macro that doesn't
actually tell us what it is doing with said kmem_cache......

Up until now I've chosen not switch XFS to use it because many of
the slab caches we use in XFS are not just "default" slab caches.
IOWs, we still have to use kmem_cache_create() for a lot of the
caches we create, so we may as well use kmem_cache_create() for all of them
rather than have to go look up what KMEM_CACHE() translates to every
time we are looking at how slab caches are created.

Also, if you are going to change simple API stuff like this in XFS,
please do all the conversions in a single patch. It takes much less
time and resources to review and merge a single patch compared to a
couple of dozen independent one line patches...

-Dave.
-- 
Dave Chinner
david@fromorbit.com

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

end of thread, other threads:[~2024-02-05 10:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-05  8:12 [PATCH] xfs: Simplify the allocation of slab caches in xfs_rmap_intent_init_cache Kunwu Chan
2024-02-05 10:07 ` Dave Chinner

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