Recent changes (master)
The following changes since commit a7abc9fb769596d3bbf6d779e99d1cb8c1fcd49b:
t/io_uring: add support for registered files (2019-01-10 22:29:27 -0700)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to e0abe38815e1c8cf7a319c6fbd0b1d60691db3d5:
t/io_uring: only set IORING_ENTER_GETEVENTS when actively reaping (2019-01-11 14:40:16 -0700)
----------------------------------------------------------------
Jens Axboe (4):
io_uring: update to newer API
t/io_uring: remember to set p->sq_thread_cpu engines/io_uring: remove unused ld->io_us array t/io_uring: only set IORING_ENTER_GETEVENTS when actively reaping
engines/io_uring.c | 27 +++++++++++++++------------ os/io_uring.h | 31 ++++++++++++++++++++----------- t/io_uring.c | 47 ++++++++++++++++++++++++++++------------------- 3 files changed, 63 insertions(+), 42 deletions(-)
---
Diff of recent changes:
engines/io_uring.c +15 -12
@@ -48,7 +48,6 @@ struct ioring_mmap {struct ioring_data {int ring_fd; -struct io_u **io_us;struct io_u **io_u_index;struct io_sq_ring sq_ring;
@@ -150,25 +149,31 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u) sqe->buf_index =0 ;if (io_u->ddir ==DDIR_READ || io_u->ddir ==DDIR_WRITE ) { -if (io_u->ddir ==DDIR_READ ) - sqe->opcode =IORING_OP_READV ; -else - sqe->opcode =IORING_OP_WRITEV ; -if (o->fixedbufs) { - sqe->flags |=IOSQE_FIXED_BUFFER ; +if (io_u->ddir ==DDIR_READ ) + sqe->opcode =IORING_OP_READ_FIXED ; +else + sqe->opcode =IORING_OP_WRITE_FIXED ; sqe->addr = io_u->xfer_buf; sqe->len = io_u->xfer_buflen; sqe->buf_index = io_u->index; }else { +if (io_u->ddir ==DDIR_READ ) + sqe->opcode =IORING_OP_READV ; +else + sqe->opcode =IORING_OP_WRITEV ; sqe->addr = &ld->iovecs[io_u->index]; sqe->len =1 ; } sqe->off = io_u->offset; - }else if (ddir_sync (io_u->ddir)) + }else if (ddir_sync (io_u->ddir)) { + sqe->fsync_flags =0 ; +if (io_u->ddir ==DDIR_DATASYNC ) + sqe->fsync_flags |=IORING_FSYNC_DATASYNC ; sqe->opcode =IORING_OP_FSYNC ; + } - sqe->data = (unsigned long ) io_u; + sqe->user_data = (unsigned long ) io_u;return 0 ; }
@@ -182,7 +187,7 @@ static struct io_u *fio_ioring_event(struct thread_data *td, int event) index = (event + ld->cq_ring_off) & ld->cq_ring_mask; cqe = &ld->cq_ring.cqes[index]; - io_u = (struct io_u *) cqe->data; + io_u = (struct io_u *) cqe->user_data;if (cqe->res != io_u->xfer_buflen) {if (cqe->res > io_u->xfer_buflen)
@@ -390,7 +395,6 @@ static void fio_ioring_cleanup(struct thread_data *td)fio_ioring_unmap (ld);free (ld->io_u_index); -free (ld->io_us);free (ld->iovecs);free (ld); }
@@ -526,7 +530,6 @@ 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 *)); ld->iovecs =calloc (td->o.iodepth,sizeof (struct iovec )); td->io_ops_data = ld;
os/io_uring.h +20 -11
@@ -16,7 +16,7 @@*/ struct io_uring_sqe {__u8 opcode;/* type of operation for this sqe */ -__u8 flags;/* IOSQE_ flags below */ +__u8 flags;/* IOSQE_ flags */ __u16 ioprio;/* ioprio for the request */ __s32 fd;/* file descriptor to do IO on */ __u64 off;/* offset into file */
@@ -27,18 +27,18 @@ struct io_uring_sqe {__u32 len;/* buffer size or number of iovecs */ union {__kernel_rwf_t rw_flags; -__u32 __resv; +__u32 fsync_flags; };__u16 buf_index;/* index into fixed buffers, if used */ -__u16 __pad2[3 ]; -__u64 data;/* data to be passed back at completion time */ +__u16 __pad2; +__u32 __pad3; +__u64 user_data;/* data to be passed back at completion time */ };/* * sqe->flags */ -#define IOSQE_FIXED_BUFFER (1 << 0)/* use fixed buffer */ -#define IOSQE_FIXED_FILE (1 << 1)/* use fixed fileset */ +#define IOSQE_FIXED_FILE (1 << 0)/* use fixed fileset */ /* * io_uring_setup() flags
@@ -50,13 +50,19 @@ struct io_uring_sqe {#define IORING_OP_READV 1#define IORING_OP_WRITEV 2#define IORING_OP_FSYNC 3 -#define IORING_OP_FDSYNC 4 +#define IORING_OP_READ_FIXED 4 +#define IORING_OP_WRITE_FIXED 5 + +/* +* sqe->fsync_flags +*/ +#define IORING_FSYNC_DATASYNC (1 << 0)/* * IO completion data structure (Completion Queue Entry) */ struct io_uring_cqe { -__u64 data;/* sqe->data submission passed back */ +__u64 user_data;/* sqe->data submission passed back */ __s32 res;/* result code for this event */ __u32 flags; };
@@ -87,6 +93,9 @@ struct io_sqring_offsets {__u32 resv[3 ]; }; +/* +* sq_ring->flags +*/ #define IORING_SQ_NEED_WAKEUP (1 << 0)/* needs io_uring_enter wakeup */ struct io_cqring_offsets {
@@ -127,12 +136,12 @@ struct io_uring_params {struct io_uring_register_buffers {struct iovec *iovecs; -unsigned nr_iovecs; +__u32 nr_iovecs; };struct io_uring_register_files { -int *fds; -unsigned nr_fds; +__s32 *fds; +__u32 nr_fds; };#endif
t/io_uring.c +28 -19
121 lines not on this page · raw message