All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: use KMEM_CACHE macro
@ 2019-05-27 11:48 Peng Wang
  2019-05-28 18:50 ` Omar Sandoval
  2019-05-28 21:00 ` Chaitanya Kulkarni
  0 siblings, 2 replies; 4+ messages in thread
From: Peng Wang @ 2019-05-27 11:48 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Peng Wang

From: Peng Wang <rocking@whu.edu.cn>

Use the preferred KMEM_CACHE helper for brevity.

Signed-off-by: Peng Wang <rocking@whu.edu.cn>
---
 block/blk-core.c | 3 +--
 block/blk-ioc.c  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 1bf83a0df0f6..841bf0b12755 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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);
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 5ed59ac6ae58..58c79aeca955 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -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);
-- 
2.19.1


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

* Re: [PATCH] block: use KMEM_CACHE macro
  2019-05-27 11:48 [PATCH] block: use KMEM_CACHE macro Peng Wang
@ 2019-05-28 18:50 ` Omar Sandoval
  2019-05-28 21:00 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 4+ messages in thread
From: Omar Sandoval @ 2019-05-28 18:50 UTC (permalink / raw)
  To: Peng Wang; +Cc: axboe, linux-block, linux-kernel, Peng Wang

On Mon, May 27, 2019 at 07:48:35PM +0800, Peng Wang wrote:
> From: Peng Wang <rocking@whu.edu.cn>
> 
> Use the preferred KMEM_CACHE helper for brevity.

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: Peng Wang <rocking@whu.edu.cn>
> ---
>  block/blk-core.c | 3 +--
>  block/blk-ioc.c  | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 1bf83a0df0f6..841bf0b12755 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -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);
> diff --git a/block/blk-ioc.c b/block/blk-ioc.c
> index 5ed59ac6ae58..58c79aeca955 100644
> --- a/block/blk-ioc.c
> +++ b/block/blk-ioc.c
> @@ -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.

>  	return 0;
>  }
>  subsys_initcall(blk_ioc_init);
> -- 
> 2.19.1
> 

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

* Re: [PATCH] block: use KMEM_CACHE macro
  2019-05-27 11:48 [PATCH] block: use KMEM_CACHE macro Peng Wang
  2019-05-28 18:50 ` Omar Sandoval
@ 2019-05-28 21:00 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-05-28 21:00 UTC (permalink / raw)
  To: Peng Wang, axboe; +Cc: linux-block, linux-kernel, Peng Wang

Thanks for your patch.

It also makes the cache name consistent with the structure name.
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

On 05/27/2019 04:50 AM, Peng Wang wrote:
> From: Peng Wang <rocking@whu.edu.cn>
>
> Use the preferred KMEM_CACHE helper for brevity.
>
> Signed-off-by: Peng Wang <rocking@whu.edu.cn>
> ---
>   block/blk-core.c | 3 +--
>   block/blk-ioc.c  | 3 +--
>   2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 1bf83a0df0f6..841bf0b12755 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -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);
> diff --git a/block/blk-ioc.c b/block/blk-ioc.c
> index 5ed59ac6ae58..58c79aeca955 100644
> --- a/block/blk-ioc.c
> +++ b/block/blk-ioc.c
> @@ -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);
>


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

* [PATCH] block: use KMEM_CACHE macro
@ 2019-05-27 12:05 Peng Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Wang @ 2019-05-27 12:05 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Peng Wang

Use the preferred KMEM_CACHE helper for brevity.

Signed-off-by: Peng Wang <rocking@whu.edu.cn>
---
 block/blk-core.c | 3 +--
 block/blk-ioc.c  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 1bf83a0df0f6..841bf0b12755 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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);
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 5ed59ac6ae58..58c79aeca955 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -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);
-- 
2.19.1


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

end of thread, other threads:[~2019-05-28 21:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 11:48 [PATCH] block: use KMEM_CACHE macro Peng Wang
2019-05-28 18:50 ` Omar Sandoval
2019-05-28 21:00 ` Chaitanya Kulkarni
2019-05-27 12:05 Peng Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.