2020-12-10 07:26:05

by Tianxianting

[permalink] [raw]
Subject: [PATCH] [v2] blk-mq-tag: make blk_mq_tag_busy() return void

As no one cares about the return value of blk_mq_tag_busy() and
__blk_mq_tag_busy(), so make them return void.

Other change is to simplify blk_mq_tag_idle().

Signed-off-by: Xianting Tian <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
---
block/blk-mq-tag.c | 4 ++--
block/blk-mq-tag.h | 16 ++++++----------
2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 9c92053e7..21ff7d156 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -21,7 +21,7 @@
* to get tag when first time, the other shared-tag users could reserve
* budget for it.
*/
-bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
+void __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
{
if (blk_mq_is_sbitmap_shared(hctx->flags)) {
struct request_queue *q = hctx->queue;
@@ -36,7 +36,7 @@ bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
atomic_inc(&hctx->tags->active_queues);
}

- return true;
+ return;
}

/*
diff --git a/block/blk-mq-tag.h b/block/blk-mq-tag.h
index 7d3e6b333..4b4ccd794 100644
--- a/block/blk-mq-tag.h
+++ b/block/blk-mq-tag.h
@@ -60,23 +60,19 @@ enum {
BLK_MQ_TAG_MAX = BLK_MQ_NO_TAG - 1,
};

-extern bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *);
+extern void __blk_mq_tag_busy(struct blk_mq_hw_ctx *);
extern void __blk_mq_tag_idle(struct blk_mq_hw_ctx *);

-static inline bool blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
+static inline void blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
{
- if (!(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED))
- return false;
-
- return __blk_mq_tag_busy(hctx);
+ if (hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)
+ __blk_mq_tag_busy(hctx);
}

static inline void blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)
{
- if (!(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED))
- return;
-
- __blk_mq_tag_idle(hctx);
+ if (hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)
+ __blk_mq_tag_idle(hctx);
}

static inline bool blk_mq_tag_is_reserved(struct blk_mq_tags *tags,
--
2.17.1


2020-12-10 07:29:57

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH] [v2] blk-mq-tag: make blk_mq_tag_busy() return void

On 12/9/20 22:06, Xianting Tian wrote:
> As no one cares about the return value of blk_mq_tag_busy() and
> __blk_mq_tag_busy(), so make them return void.
>
> Other change is to simplify blk_mq_tag_idle().
>
> Signed-off-by: Xianting Tian <[email protected]>
> Reviewed-by: Ming Lei <[email protected]>
> ---
> block/blk-mq-tag.c | 4 ++--
> block/blk-mq-tag.h | 16 ++++++----------
> 2 files changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
> index 9c92053e7..21ff7d156 100644
> --- a/block/blk-mq-tag.c
> +++ b/block/blk-mq-tag.c
> @@ -21,7 +21,7 @@
> * to get tag when first time, the other shared-tag users could reserve
> * budget for it.
> */
> -bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
> +void __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
> {
> if (blk_mq_is_sbitmap_shared(hctx->flags)) {
> struct request_queue *q = hctx->queue;
> @@ -36,7 +36,7 @@ bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
> atomic_inc(&hctx->tags->active_queues);
> }
>
> - return true;
> + return;
if above return is the last statement then you need to remove that
instead of using return with no value.

Also, please add the version history.

2020-12-10 11:04:42

by Tianxianting

[permalink] [raw]
Subject: RE: [PATCH] [v2] blk-mq-tag: make blk_mq_tag_busy() return void

Yes,
Sorry, In V2. I missed it, so I sent v3 :)

-----Original Message-----
From: Chaitanya Kulkarni [mailto:[email protected]]
Sent: Thursday, December 10, 2020 2:21 PM
To: tianxianting (RD) <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] [v2] blk-mq-tag: make blk_mq_tag_busy() return void

On 12/9/20 22:06, Xianting Tian wrote:
> As no one cares about the return value of blk_mq_tag_busy() and
> __blk_mq_tag_busy(), so make them return void.
>
> Other change is to simplify blk_mq_tag_idle().
>
> Signed-off-by: Xianting Tian <[email protected]>
> Reviewed-by: Ming Lei <[email protected]>
> ---
> block/blk-mq-tag.c | 4 ++--
> block/blk-mq-tag.h | 16 ++++++----------
> 2 files changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index
> 9c92053e7..21ff7d156 100644
> --- a/block/blk-mq-tag.c
> +++ b/block/blk-mq-tag.c
> @@ -21,7 +21,7 @@
> * to get tag when first time, the other shared-tag users could reserve
> * budget for it.
> */
> -bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
> +void __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
> {
> if (blk_mq_is_sbitmap_shared(hctx->flags)) {
> struct request_queue *q = hctx->queue; @@ -36,7 +36,7 @@ bool
> __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
> atomic_inc(&hctx->tags->active_queues);
> }
>
> - return true;
> + return;
if above return is the last statement then you need to remove that instead of using return with no value.

Also, please add the version history.