block: use KMEM_CACHE macro
PATCH 1/1 block: use KMEM_CACHE macro
From: Peng Wang <[email protected]>
Use the preferred KMEM_CACHE helper for brevity.
Signed-off-by Peng Wang <[email protected]>
--- block/blk-core.c | 3 +-- block/blk-ioc.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
block/blk-core.c +1 -2
@@ -1789,8 +1789,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 );#ifdef CONFIG_DEBUG_FS blk_debugfs_root =debugfs_create_dir ("block" ,NULL );
block/blk-ioc.c +1 -2
@@ -408,8 +408,7 @@ struct io_cq *ioc_create_icq(struct io_context *ioc, struct request_queue *q,static int __init blk_ioc_init (void ) { - iocontext_cachep =kmem_cache_create ("blkdev_ioc" , -sizeof (struct io_context ),0 ,SLAB_PANIC ,NULL ); + iocontext_cachep =KMEM_CACHE (io_context,SLAB_PANIC );return 0 ; }subsys_initcall (blk_ioc_init);
Signature · 1 line
2.19.1
Quoted 3 lines · Peng Wang
From: Peng Wang <[email protected]>
Use the preferred
KMEM_CACHEhelper for brevity.
Reviewed-by Omar Sandoval <[email protected]>
Quoted 25 lines
Signed-off-by Peng Wang <[email protected]>--- block/blk-core.c | 3 +-- block/blk-ioc.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)block/blk-core.c +1
-2@@ -1789,8 +1789,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 );#ifdef CONFIG_DEBUG_FS blk_debugfs_root =debugfs_create_dir ("block" ,NULL );block/blk-ioc.c +0
-0
block/blk-ioc.c struct io_cq *ioc_create_icq(struct io_context *ioc, struct request_queue *q, · line 411
Quoted 6 lines
block/blk-ioc.c +1
-2@@ -408,8 +408,7 @@ struct io_cq *ioc_create_icq(struct io_context *ioc, struct request_queue *q,static int __init blk_ioc_init (void ) { - iocontext_cachep =kmem_cache_create ("blkdev_ioc" , -sizeof (struct io_context ),0 ,SLAB_PANIC ,NULL ); + iocontext_cachep =KMEM_CACHE (io_context,SLAB_PANIC );
This will change the name of the slab in slabinfo, but I can't imagine that matters.
Quoted 6 lines
block/blk-ioc.c +0
-0return 0 ; }subsys_initcall (blk_ioc_init);Signature · 1 line
2.19.1
Thanks for your patch.
It also makes the cache name consistent with the structure name. Looks good.
Reviewed-by Chaitanya Kulkarni <[email protected]>
Quoted 39 lines · Peng Wang
From: Peng Wang <[email protected]>
Use the preferred
KMEM_CACHEhelper for brevity.Signed-off-by Peng Wang <[email protected]>--- block/blk-core.c | 3 +-- block/blk-ioc.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)block/blk-core.c +1
-2@@ -1789,8 +1789,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 );#ifdef CONFIG_DEBUG_FS blk_debugfs_root =debugfs_create_dir ("block" ,NULL );block/blk-ioc.c +1
-2@@ -408,8 +408,7 @@ struct io_cq *ioc_create_icq(struct io_context *ioc, struct request_queue *q,static int __init blk_ioc_init (void ) { - iocontext_cachep =kmem_cache_create ("blkdev_ioc" , -sizeof (struct io_context ),0 ,SLAB_PANIC ,NULL ); + iocontext_cachep =KMEM_CACHE (io_context,SLAB_PANIC );return 0 ; }subsys_initcall (blk_ioc_init);