Skip to content

Commit

Permalink
blk-mq: use plug for devices that implement ->commits_rqs()
Browse files Browse the repository at this point in the history
If we have that hook, we know the driver handles bd->last == true in
a smart fashion. If it does, even for multiple hardware queues, it's
a good idea to flush batches of requests to the device, if we have
batches of requests from the submitter.

Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Nov 29, 2018
1 parent be94f05 commit b2c5d16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,11 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
/* bypass scheduler for flush rq */
blk_insert_flush(rq);
blk_mq_run_hw_queue(data.hctx, true);
} else if (plug && q->nr_hw_queues == 1) {
} else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs)) {
/*
* Use plugging if we have a ->commit_rqs() hook as well, as
* we know the driver uses bd->last in a smart fashion.
*/
unsigned int request_count = plug->rq_count;
struct request *last = NULL;

Expand Down

0 comments on commit b2c5d16

Please sign in to comment.