From 832faaafd3de59ebdb31043c04316ddbf0b95ad9 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 10 Aug 2020 20:52:09 -0600 Subject: [PATCH] engines/io_uring: make sure state is updated for requeues Currently we always use the start of the buffer and buffer length, but this isn't valid for a requeue. Make sure we updated both based on the actual io_u. Signed-off-by: Jens Axboe --- engines/io_uring.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 0ccd2318..57925594 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -234,13 +234,21 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u) sqe->len = io_u->xfer_buflen; sqe->buf_index = io_u->index; } else { + struct iovec *iov = &ld->iovecs[io_u->index]; + + /* + * Update based on actual io_u, requeue could have + * adjusted these + */ + iov->iov_base = io_u->xfer_buf; + iov->iov_len = io_u->xfer_buflen; + sqe->opcode = ddir_to_op[io_u->ddir][!!o->nonvectored]; if (o->nonvectored) { - sqe->addr = (unsigned long) - ld->iovecs[io_u->index].iov_base; - sqe->len = ld->iovecs[io_u->index].iov_len; + sqe->addr = (unsigned long) iov->iov_base; + sqe->len = iov->iov_len; } else { - sqe->addr = (unsigned long) &ld->iovecs[io_u->index]; + sqe->addr = (unsigned long) iov; sqe->len = 1; } } -- 2.25.1