block: Simplify the allocation of slab caches

Message ID 20240131094323.146659-1-chentao@kylinos.cn
State New
Headers
Series block: Simplify the allocation of slab caches |

Commit Message

Kunwu Chan Jan. 31, 2024, 9:43 a.m. UTC
  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>
---
 block/blk-core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Johannes Thumshirn Jan. 31, 2024, 10:08 a.m. UTC | #1
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
  
Jens Axboe Feb. 8, 2024, 6:32 p.m. UTC | #2
On Wed, 31 Jan 2024 17:43:23 +0800, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
> 
> 

Applied, thanks!

[1/1] block: Simplify the allocation of slab caches
      commit: 48ff13a618b54aabc447659a9016068cf0cae322

Best regards,
  

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index f28859b4a3ef..6898d2e6e3c4 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1224,8 +1224,7 @@  int __init blk_dev_init(void)
 	if (!kblockd_workqueue)
 		panic("Failed to create kblockd\n");
 
-	blk_requestq_cachep = kmem_cache_create("request_queue",
-			sizeof(struct request_queue), 0, SLAB_PANIC, NULL);
+	blk_requestq_cachep = KMEM_CACHE(request_queue, SLAB_PANIC);
 
 	blk_debugfs_root = debugfs_create_dir("block", NULL);