mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] blk-mq: use BLK_MQ_NO_TAG for no tag
@ 2020-08-23 15:44 Xianting Tian
  2020-08-23 20:58 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Xianting Tian @ 2020-08-23 15:44 UTC (permalink / raw)
  To: axboe, ast, daniel, kafai, songliubraving, yhs, andriin,
	john.fastabend, kpsingh
  Cc: linux-block, linux-kernel, Xianting Tian

Replace various magic -1 constants for tags with BLK_MQ_NO_TAG.

Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
---
 block/blk-core.c       | 4 ++--
 block/blk-mq-sched.c   | 2 +-
 include/linux/blk-mq.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index d9d632639..c7eaf7504 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -116,8 +116,8 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
 	rq->__sector = (sector_t) -1;
 	INIT_HLIST_NODE(&rq->hash);
 	RB_CLEAR_NODE(&rq->rb_node);
-	rq->tag = -1;
-	rq->internal_tag = -1;
+	rq->tag = BLK_MQ_NO_TAG;
+	rq->internal_tag = BLK_MQ_NO_TAG;
 	rq->start_time_ns = ktime_get_ns();
 	rq->part = NULL;
 	refcount_set(&rq->ref, 1);
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index a19cdf159..439481f59 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -522,7 +522,7 @@ void blk_mq_sched_insert_request(struct request *rq, bool at_head,
 		goto run;
 	}
 
-	WARN_ON(e && (rq->tag != -1));
+	WARN_ON(e && (rq->tag != BLK_MQ_NO_TAG));
 
 	if (blk_mq_sched_bypass_insert(hctx, !!e, rq)) {
 		/*
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 9d2d5ad36..161d8a0e6 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -569,7 +569,7 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq)
 static inline blk_qc_t request_to_qc_t(struct blk_mq_hw_ctx *hctx,
 		struct request *rq)
 {
-	if (rq->tag != -1)
+	if (rq->tag != BLK_MQ_NO_TAG)
 		return rq->tag | (hctx->queue_num << BLK_QC_T_SHIFT);
 
 	return rq->internal_tag | (hctx->queue_num << BLK_QC_T_SHIFT) |
-- 
2.17.1


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

* Re: [PATCH] blk-mq: use BLK_MQ_NO_TAG for no tag
  2020-08-23 15:44 [PATCH] blk-mq: use BLK_MQ_NO_TAG for no tag Xianting Tian
@ 2020-08-23 20:58 ` Jens Axboe
  2020-08-24  6:18   ` Tianxianting
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2020-08-23 20:58 UTC (permalink / raw)
  To: Xianting Tian, ast, daniel, kafai, songliubraving, yhs, andriin,
	john.fastabend, kpsingh
  Cc: linux-block, linux-kernel

On 8/23/20 9:44 AM, Xianting Tian wrote:
> Replace various magic -1 constants for tags with BLK_MQ_NO_TAG.

Doesn't look like this patch was even compiled...

-- 
Jens Axboe


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

* RE: [PATCH] blk-mq: use BLK_MQ_NO_TAG for no tag
  2020-08-23 20:58 ` Jens Axboe
@ 2020-08-24  6:18   ` Tianxianting
  0 siblings, 0 replies; 3+ messages in thread
From: Tianxianting @ 2020-08-24  6:18 UTC (permalink / raw)
  To: Jens Axboe, ast, daniel, kafai, songliubraving, yhs, andriin,
	john.fastabend, kpsingh
  Cc: linux-block, linux-kernel

Hi Jens
Sorry to trouble you, I am very sorry for taking it for granted for the patch compile.

I checked, compile for the two changed files are OK:
block/blk-core.c
block/blk-mq-sched.c

Compile failed for the function in below header file:
include/linux/blk-mq.h: request_to_qc_t()
-       if (rq->tag != -1)
+       if (rq->tag != BLK_MQ_NO_TAG)

BLK_MQ_NO_TAG is defined in 'block/blk-mq-tag.h',  if I include this header file in 'include/linux/blk-mq.h' via '#include "../../block/blk-mq-tag.h"', 
Many other similar compile failed happen, for example:
In file included from ./include/linux/../../block/blk-mq-tag.h:5:0,
                 from ./include/linux/blk-mq.h:8,
                 from block/blk.h:6,
                 from block/bio.c:24:
./include/linux/../../block/blk-mq.h:21:29: error: ‘HCTX_MAX_TYPES’ undeclared here (not in a function); did you mean ‘KOBJ_NS_TYPES’?
   struct list_head rq_lists[HCTX_MAX_TYPES];
                             ^~~~~~~~~~~~~~
If I moved below BLK_MQ_NO_TAG definition to 'include/linux/blk-mq.h', all kernel compiles are ok with the patch.
enum {
        BLK_MQ_NO_TAG           = -1U,
        BLK_MQ_TAG_MIN          = 1,
        BLK_MQ_TAG_MAX          = BLK_MQ_NO_TAG - 1,
};
Will you accept above moving of BLK_MQ_NO_TAG to 'include/linux/blk-mq.h'?   
Thanks

-----Original Message-----
From: Jens Axboe [mailto:axboe@kernel.dk] 
Sent: Monday, August 24, 2020 4:58 AM
To: tianxianting (RD) <tian.xianting@h3c.com>; ast@kernel.org; daniel@iogearbox.net; kafai@fb.com; songliubraving@fb.com; yhs@fb.com; andriin@fb.com; john.fastabend@gmail.com; kpsingh@chromium.org
Cc: linux-block@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] blk-mq: use BLK_MQ_NO_TAG for no tag

On 8/23/20 9:44 AM, Xianting Tian wrote:
> Replace various magic -1 constants for tags with BLK_MQ_NO_TAG.

Doesn't look like this patch was even compiled...

-- 
Jens Axboe


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

end of thread, other threads:[~2020-08-24  7:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23 15:44 [PATCH] blk-mq: use BLK_MQ_NO_TAG for no tag Xianting Tian
2020-08-23 20:58 ` Jens Axboe
2020-08-24  6:18   ` Tianxianting

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome