Skip to content

Commit

Permalink
blk-mq: put driver tag when this request is completed
Browse files Browse the repository at this point in the history
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 <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Ming Lei authored and Jens Axboe committed Jun 29, 2020
1 parent a2e83ef commit 36a3df5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 0 additions & 6 deletions block/blk-flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
blk_mq_tag_set_rq(hctx, flush_rq->tag, fq->orig_rq);
flush_rq->tag = -1;
} else {
blk_mq_put_driver_tag(flush_rq);
flush_rq->internal_tag = -1;
}

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

if (q->elevator) {
WARN_ON(rq->tag < 0);
blk_mq_put_driver_tag(rq);
}

/*
* After populating an empty queue, kick it to avoid stall. Read
* the comment in flush_end_io().
Expand Down
2 changes: 2 additions & 0 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,8 @@ bool blk_mq_complete_request_remote(struct request *rq)
{
WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);

blk_mq_put_driver_tag(rq);

/*
* For a polled request, always complete locallly, it's pointless
* to redirect the completion.
Expand Down

0 comments on commit 36a3df5

Please sign in to comment.