Skip to content

Commit b2c5d16

Browse files
committed
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent be94f05 commit b2c5d16

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

block/blk-mq.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,11 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
19451945
/* bypass scheduler for flush rq */
19461946
blk_insert_flush(rq);
19471947
blk_mq_run_hw_queue(data.hctx, true);
1948-
} else if (plug && q->nr_hw_queues == 1) {
1948+
} else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs)) {
1949+
/*
1950+
* Use plugging if we have a ->commit_rqs() hook as well, as
1951+
* we know the driver uses bd->last in a smart fashion.
1952+
*/
19491953
unsigned int request_count = plug->rq_count;
19501954
struct request *last = NULL;
19511955

0 commit comments

Comments
 (0)