From: Jens Axboe Date: Tue, 8 Sep 2020 15:57:03 +0000 (-0600) Subject: engines/io_uring: allow setting of IOSQE_ASYNC X-Git-Tag: fio-3.24~33 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=5a59a81d2923d25698b483571ee86be9f1f02631;p=fio.git engines/io_uring: allow setting of IOSQE_ASYNC Add engine option 'force_async'. If that is set to N, then every N requests will have IOSQE_ASYNC set to force async offload. Signed-off-by: Jens Axboe --- diff --git a/engines/io_uring.c b/engines/io_uring.c index ca5b90c9..e2b5e6ee 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -66,6 +66,7 @@ struct ioring_data { unsigned iodepth; bool ioprio_class_set; bool ioprio_set; + int prepped; struct ioring_mmap mmap[3]; }; @@ -82,6 +83,7 @@ struct ioring_options { unsigned int nonvectored; unsigned int uncached; unsigned int nowait; + unsigned int force_async; }; static const int ddir_to_op[2][2] = { @@ -197,6 +199,15 @@ static struct fio_option options[] = { .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_IOURING, }, + { + .name = "force_async", + .lname = "Force async", + .type = FIO_OPT_INT, + .off1 = offsetof(struct ioring_options, force_async), + .help = "Set IOSQE_ASYNC every N requests", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_IOURING, + }, { .name = NULL, }, @@ -277,6 +288,11 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u) } } + if (o->force_async && ++ld->prepped == o->force_async) { + ld->prepped = 0; + sqe->flags |= IOSQE_ASYNC; + } + sqe->user_data = (unsigned long) io_u; return 0; }