From 650346e17d045366b817814dd3e10dc94d0d990f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 9 Jan 2019 15:11:04 -0700 Subject: [PATCH] engines/io_uring: always setup ld->iovecs[] We need it now for the vectored commands. But only pass it in to ring setup, if we use fixedbufs. Signed-off-by: Jens Axboe --- engines/io_uring.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 96c9f8fb..06355e9c 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -445,6 +445,7 @@ static int fio_ioring_queue_init(struct thread_data *td) struct ioring_data *ld = td->io_ops_data; struct ioring_options *o = td->eo; int depth = td->o.iodepth; + struct iovec *vecs = NULL; struct io_uring_params p; int ret; @@ -468,9 +469,10 @@ static int fio_ioring_queue_init(struct thread_data *td) }; setrlimit(RLIMIT_MEMLOCK, &rlim); + vecs = ld->iovecs; } - ret = syscall(__NR_sys_io_uring_setup, depth, ld->iovecs, &p); + ret = syscall(__NR_sys_io_uring_setup, depth, vecs, &p); if (ret < 0) return ret; @@ -481,20 +483,15 @@ static int fio_ioring_queue_init(struct thread_data *td) static int fio_ioring_post_init(struct thread_data *td) { struct ioring_data *ld = td->io_ops_data; - struct ioring_options *o = td->eo; struct io_u *io_u; - int err; - - if (o->fixedbufs) { - int i; + int err, i; - for (i = 0; i < td->o.iodepth; i++) { - struct iovec *iov = &ld->iovecs[i]; + for (i = 0; i < td->o.iodepth; i++) { + struct iovec *iov = &ld->iovecs[i]; - io_u = ld->io_u_index[i]; - iov->iov_base = io_u->buf; - iov->iov_len = td_max_bs(td); - } + io_u = ld->io_u_index[i]; + iov->iov_base = io_u->buf; + iov->iov_len = td_max_bs(td); } err = fio_ioring_queue_init(td); @@ -513,7 +510,6 @@ static unsigned roundup_pow2(unsigned depth) static int fio_ioring_init(struct thread_data *td) { - struct ioring_options *o = td->eo; struct ioring_data *ld; ld = calloc(1, sizeof(*ld)); @@ -525,9 +521,7 @@ static int fio_ioring_init(struct thread_data *td) /* io_u index */ ld->io_u_index = calloc(td->o.iodepth, sizeof(struct io_u *)); ld->io_us = calloc(td->o.iodepth, sizeof(struct io_u *)); - - if (o->fixedbufs) - ld->iovecs = calloc(td->o.iodepth, sizeof(struct iovec)); + ld->iovecs = calloc(td->o.iodepth, sizeof(struct iovec)); td->io_ops_data = ld; return 0; -- 2.25.1