From cfcc8564b9a448f3e6b7607c22bf899afb608b1c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 8 Jan 2019 10:26:19 -0700 Subject: [PATCH] engines/io_uring: ensure to use the right opcode for fixed buffers 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 e051086b..55f48eda 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -149,6 +149,7 @@ static int io_uring_enter(struct ioring_data *ld, unsigned int to_submit, static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u) { struct ioring_data *ld = td->io_ops_data; + struct ioring_options *o = td->eo; struct fio_file *f = io_u->file; struct io_uring_iocb *iocb; @@ -158,10 +159,17 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u) iocb->ioprio = 0; if (io_u->ddir == DDIR_READ || io_u->ddir == DDIR_WRITE) { - if (io_u->ddir == DDIR_READ) - iocb->opcode = IORING_OP_READ; - else - iocb->opcode = IORING_OP_WRITE; + if (io_u->ddir == DDIR_READ) { + if (o->fixedbufs) + iocb->opcode = IORING_OP_READ_FIXED; + else + iocb->opcode = IORING_OP_READ; + } else { + if (o->fixedbufs) + iocb->opcode = IORING_OP_WRITE_FIXED; + else + iocb->opcode = IORING_OP_WRITE; + } iocb->off = io_u->offset; iocb->addr = io_u->xfer_buf; iocb->len = io_u->xfer_buflen; -- 2.25.1