aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-mq.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 8d3de5bd4d6f..077c2416a955 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1453,13 +1453,18 @@ static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio)
1453 */ 1453 */
1454 plug = current->plug; 1454 plug = current->plug;
1455 if (plug) { 1455 if (plug) {
1456 struct request *last = NULL;
1457
1456 blk_mq_bio_to_request(rq, bio); 1458 blk_mq_bio_to_request(rq, bio);
1457 if (!request_count) 1459 if (!request_count)
1458 trace_block_plug(q); 1460 trace_block_plug(q);
1461 else
1462 last = list_entry_rq(plug->mq_list.prev);
1459 1463
1460 blk_mq_put_ctx(data.ctx); 1464 blk_mq_put_ctx(data.ctx);
1461 1465
1462 if (request_count >= BLK_MAX_REQUEST_COUNT) { 1466 if (request_count >= BLK_MAX_REQUEST_COUNT || (last &&
1467 blk_rq_bytes(last) >= BLK_PLUG_FLUSH_SIZE)) {
1463 blk_flush_plug_list(plug, false); 1468 blk_flush_plug_list(plug, false);
1464 trace_block_plug(q); 1469 trace_block_plug(q);
1465 } 1470 }