block: don't reorder requests in blk_add_rq_to_plug

Add requests to the tail of the list instead of the front so that they
are queued up in submission order.

Remove the re-reordering in blk_mq_dispatch_plug_list, virtio_queue_rqs
and nvme_queue_rqs now that the list is ordered as expected.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20241113152050.157179-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2024-11-13 16:20:45 +01:00 committed by Jens Axboe
parent a3396b9999
commit e70c301fae
3 changed files with 4 additions and 4 deletions

View File

@ -1392,7 +1392,7 @@ static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq)
*/ */
if (!plug->has_elevator && (rq->rq_flags & RQF_SCHED_TAGS)) if (!plug->has_elevator && (rq->rq_flags & RQF_SCHED_TAGS))
plug->has_elevator = true; plug->has_elevator = true;
rq_list_add_head(&plug->mq_list, rq); rq_list_add_tail(&plug->mq_list, rq);
plug->rq_count++; plug->rq_count++;
} }
@ -2844,7 +2844,7 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
rq_list_add_tail(&requeue_list, rq); rq_list_add_tail(&requeue_list, rq);
continue; continue;
} }
list_add(&rq->queuelist, &list); list_add_tail(&rq->queuelist, &list);
depth++; depth++;
} while (!rq_list_empty(&plug->mq_list)); } while (!rq_list_empty(&plug->mq_list));

View File

@ -514,7 +514,7 @@ static void virtio_queue_rqs(struct rq_list *rqlist)
vq = this_vq; vq = this_vq;
if (virtblk_prep_rq_batch(req)) if (virtblk_prep_rq_batch(req))
rq_list_add_head(&submit_list, req); /* reverse order */ rq_list_add_tail(&submit_list, req);
else else
rq_list_add_tail(&requeue_list, req); rq_list_add_tail(&requeue_list, req);
} }

View File

@ -945,7 +945,7 @@ static void nvme_queue_rqs(struct rq_list *rqlist)
nvmeq = req->mq_hctx->driver_data; nvmeq = req->mq_hctx->driver_data;
if (nvme_prep_rq_batch(nvmeq, req)) if (nvme_prep_rq_batch(nvmeq, req))
rq_list_add_head(&submit_list, req); /* reverse order */ rq_list_add_tail(&submit_list, req);
else else
rq_list_add_tail(&requeue_list, req); rq_list_add_tail(&requeue_list, req);
} }