[PATCH] dlm: use KMEM_CACHE in dlm_memory_init

From: Hongfu Li
Date: Wed Jun 19 2024 - 01:04:34 EST


Using KMEM_CACHE() macro makes the code more concise and easy to read.

Signed-off-by: Hongfu Li <lihongfu@xxxxxxxxxx>
---
fs/dlm/memory.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 15a8b1cee433..829cc4fe7bf1 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -34,8 +34,7 @@ int __init dlm_memory_init(void)
if (!mhandle_cache)
goto mhandle;

- lkb_cache = kmem_cache_create("dlm_lkb", sizeof(struct dlm_lkb),
- __alignof__(struct dlm_lkb), 0, NULL);
+ lkb_cache = KMEM_CACHE(dlm_lkb, 0);
if (!lkb_cache)
goto lkb;

@@ -43,14 +42,11 @@ int __init dlm_memory_init(void)
if (!msg_cache)
goto msg;

- rsb_cache = kmem_cache_create("dlm_rsb", sizeof(struct dlm_rsb),
- __alignof__(struct dlm_rsb), 0, NULL);
+ rsb_cache = KMEM_CACHE(dlm_rsb, 0);
if (!rsb_cache)
goto rsb;

- cb_cache = kmem_cache_create("dlm_cb", sizeof(struct dlm_callback),
- __alignof__(struct dlm_callback), 0,
- NULL);
+ cb_cache = KMEM_CACHE(dlm_callback, 0);
if (!cb_cache)
goto cb;

--
2.25.1