summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-11-29 10:03:42 -0700
committerJens Axboe <axboe@kernel.dk>2018-11-29 10:12:37 -0700
commitb2c5d16b72df1116f05c9be16a630ac939d34101 (patch)
tree933ddf90cf418d93f6c0e0cb63c89cc7d925094e /block
parentbe94f058f2bde6f0b0ee9059a35daa8e15be308f (diff)
blk-mq: use plug for devices that implement ->commits_rqs()
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>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 14e31e93a950..7dcef565dc0f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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;