blk-mq: remove RQF_MQ_INFLIGHT
authorChengming Zhou <zhouchengming@bytedance.com>
Wed, 13 Sep 2023 15:16:13 +0000 (15:16 +0000)
committerJens Axboe <axboe@kernel.dk>
Fri, 22 Sep 2023 14:52:13 +0000 (08:52 -0600)
Since the previous patch change to only account active requests when
we really allocate the driver tag, the RQF_MQ_INFLIGHT can be removed
and no double account problem.

1. none elevator: flush request will use the first pending request's
   driver tag, won't double account.

2. other elevator: flush request will be accounted when allocate driver
   tag when issue, and will be unaccounted when it put the driver tag.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230913151616.3164338-3-chengming.zhou@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-flush.c
block/blk-mq-debugfs.c
block/blk-mq.c
include/linux/blk-mq.h

index e73dc22d05c1d1c9dea080b8c0c9adf7dce857af..3f4d41952ef210929091ca29661b5da2be280d9c 100644 (file)
@@ -323,16 +323,9 @@ static void blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq,
        flush_rq->mq_ctx = first_rq->mq_ctx;
        flush_rq->mq_hctx = first_rq->mq_hctx;
 
-       if (!q->elevator) {
+       if (!q->elevator)
                flush_rq->tag = first_rq->tag;
-
-               /*
-                * We borrow data request's driver tag, so have to mark
-                * this flush request as INFLIGHT for avoiding double
-                * account of this driver tag
-                */
-               flush_rq->rq_flags |= RQF_MQ_INFLIGHT;
-       } else
+       else
                flush_rq->internal_tag = first_rq->internal_tag;
 
        flush_rq->cmd_flags = REQ_OP_FLUSH | REQ_PREFLUSH;
index c3b5930106b288bec70850a90f88f2fdc1ed5a38..5cbeb9344f2f5cea3121197892a412deab777838 100644 (file)
@@ -246,7 +246,6 @@ static const char *const rqf_name[] = {
        RQF_NAME(STARTED),
        RQF_NAME(FLUSH_SEQ),
        RQF_NAME(MIXED_MERGE),
-       RQF_NAME(MQ_INFLIGHT),
        RQF_NAME(DONTPREP),
        RQF_NAME(SCHED_TAGS),
        RQF_NAME(USE_SCHED),
index e776388decc35303a5997dad952769080a0b649c..c209a7dddee3fc3d93bed164361d91c66a4b7cb2 100644 (file)
@@ -1066,10 +1066,6 @@ static inline void blk_mq_flush_tag_batch(struct blk_mq_hw_ctx *hctx,
 {
        struct request_queue *q = hctx->queue;
 
-       /*
-        * All requests should have been marked as RQF_MQ_INFLIGHT, so
-        * update hctx->nr_active in batch
-        */
        blk_mq_sub_active_requests(hctx, nr_tags);
 
        blk_mq_put_tags(hctx->tags, tag_array, nr_tags);
index 958ed7e89b301e0fa968ed27dd8ae764d47ab68f..1ab3081c82edaedab451ed44d4d2a84f88b3f4d5 100644 (file)
@@ -32,8 +32,6 @@ typedef __u32 __bitwise req_flags_t;
 #define RQF_FLUSH_SEQ          ((__force req_flags_t)(1 << 4))
 /* merge of different types, fail separately */
 #define RQF_MIXED_MERGE                ((__force req_flags_t)(1 << 5))
-/* track inflight for MQ */
-#define RQF_MQ_INFLIGHT                ((__force req_flags_t)(1 << 6))
 /* don't call prep for this one */
 #define RQF_DONTPREP           ((__force req_flags_t)(1 << 7))
 /* use hctx->sched_tags */