git: cc25cfc9cf8a - main - vtblk: Requeue inside vtblk_request_execute
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Oct 2022 06:03:07 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=cc25cfc9cf8a3d21d4f989eca9a4d1060d5d488e
commit cc25cfc9cf8a3d21d4f989eca9a4d1060d5d488e
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2022-09-18 16:16:30 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2022-10-18 06:02:21 +0000
vtblk: Requeue inside vtblk_request_execute
Most virtio_blk requests are launched from vtblk_startio; prior to this
commit, if vtblk_request_execute failed (e.g. due to a lack of space on
the virtio queue) vtblk_startio would requeue the request to be
reattempted later.
Add a flag "vbr_requeue_on_error" to requests and perform the requeuing
from inside vtblk_request_execute instead.
No functional change intended.
Reviewed by: bryanv, imp
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D36665
---
sys/dev/virtio/block/virtio_blk.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c
index 8d39d80a8c91..fca2d367c170 100644
--- a/sys/dev/virtio/block/virtio_blk.c
+++ b/sys/dev/virtio/block/virtio_blk.c
@@ -62,6 +62,7 @@ struct vtblk_request {
struct virtio_blk_outhdr vbr_hdr;
struct bio *vbr_bp;
uint8_t vbr_ack;
+ uint8_t vbr_requeue_on_error;
int vbr_error;
TAILQ_ENTRY(vtblk_request) vbr_link;
};
@@ -1008,6 +1009,8 @@ vtblk_request_execute(struct vtblk_softc *sc, struct vtblk_request *req)
sc->vtblk_req_ordered = req;
out:
+ if (error && req->vbr_requeue_on_error)
+ vtblk_request_requeue_ready(sc, req);
req->vbr_error = error;
}
@@ -1133,11 +1136,10 @@ vtblk_startio(struct vtblk_softc *sc)
if (req == NULL)
break;
+ req->vbr_requeue_on_error = 1;
vtblk_request_execute(sc, req);
- if (req->vbr_error != 0) {
- vtblk_request_requeue_ready(sc, req);
+ if (req->vbr_error != 0)
break;
- }
enq++;
}