Skip to content

Commit 36a3df5

Browse files
Ming Leiaxboe
authored andcommitted
blk-mq: put driver tag when this request is completed
It is natural to release driver tag when this request is completed by LLD or device since its purpose is for LLD use. One big benefit is that the released tag can be re-used quicker since bio_endio() may take too long. Meantime we don't need to release driver tag for flush request. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent a2e83ef commit 36a3df5

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

block/blk-flush.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
240240
blk_mq_tag_set_rq(hctx, flush_rq->tag, fq->orig_rq);
241241
flush_rq->tag = -1;
242242
} else {
243-
blk_mq_put_driver_tag(flush_rq);
244243
flush_rq->internal_tag = -1;
245244
}
246245

@@ -341,11 +340,6 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error)
341340
unsigned long flags;
342341
struct blk_flush_queue *fq = blk_get_flush_queue(q, ctx);
343342

344-
if (q->elevator) {
345-
WARN_ON(rq->tag < 0);
346-
blk_mq_put_driver_tag(rq);
347-
}
348-
349343
/*
350344
* After populating an empty queue, kick it to avoid stall. Read
351345
* the comment in flush_end_io().

block/blk-mq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ bool blk_mq_complete_request_remote(struct request *rq)
674674
{
675675
WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
676676

677+
blk_mq_put_driver_tag(rq);
678+
677679
/*
678680
* For a polled request, always complete locallly, it's pointless
679681
* to redirect the completion.

0 commit comments

Comments
 (0)