io_uring: sync with upstream API
authorJens Axboe <axboe@kernel.dk>
Wed, 16 Jan 2019 15:45:43 +0000 (08:45 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 16 Jan 2019 16:00:00 +0000 (09:00 -0700)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/io_uring.c
os/linux/io_uring.h
t/io_uring.c

index 8c5d9deb65ab327392e2c0e948d32a9b785a09b4..5fda2fc96fea8f88914083f5cb9e5d9ff962d580 100644 (file)
@@ -154,7 +154,7 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u)
                                sqe->opcode = IORING_OP_READ_FIXED;
                        else
                                sqe->opcode = IORING_OP_WRITE_FIXED;
                                sqe->opcode = IORING_OP_READ_FIXED;
                        else
                                sqe->opcode = IORING_OP_WRITE_FIXED;
-                       sqe->addr = io_u->xfer_buf;
+                       sqe->addr = (unsigned long) io_u->xfer_buf;
                        sqe->len = io_u->xfer_buflen;
                        sqe->buf_index = io_u->index;
                } else {
                        sqe->len = io_u->xfer_buflen;
                        sqe->buf_index = io_u->index;
                } else {
@@ -162,7 +162,7 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u)
                                sqe->opcode = IORING_OP_READV;
                        else
                                sqe->opcode = IORING_OP_WRITEV;
                                sqe->opcode = IORING_OP_READV;
                        else
                                sqe->opcode = IORING_OP_WRITEV;
-                       sqe->addr = &ld->iovecs[io_u->index];
+                       sqe->addr = (unsigned long) &ld->iovecs[io_u->index];
                        sqe->len = 1;
                }
                sqe->off = io_u->offset;
                        sqe->len = 1;
                }
                sqe->off = io_u->offset;
@@ -478,13 +478,8 @@ static int fio_ioring_queue_init(struct thread_data *td)
        ld->ring_fd = ret;
 
        if (o->fixedbufs) {
        ld->ring_fd = ret;
 
        if (o->fixedbufs) {
-               struct io_uring_register_buffers reg = {
-                       .iovecs = ld->iovecs,
-                       .nr_iovecs = depth
-               };
-
                ret = syscall(__NR_sys_io_uring_register, ld->ring_fd,
                ret = syscall(__NR_sys_io_uring_register, ld->ring_fd,
-                               IORING_REGISTER_BUFFERS, &reg);
+                               IORING_REGISTER_BUFFERS, ld->iovecs, depth);
                if (ret < 0)
                        return ret;
        }
                if (ret < 0)
                        return ret;
        }
index 71e92026d26c2705c320b1a8e7089c6d062c90ef..9bb718168c86d4a98e774a56c36d63c538cfceaa 100644 (file)
@@ -20,10 +20,7 @@ struct io_uring_sqe {
        __u16   ioprio;         /* ioprio for the request */
        __s32   fd;             /* file descriptor to do IO on */
        __u64   off;            /* offset into file */
        __u16   ioprio;         /* ioprio for the request */
        __s32   fd;             /* file descriptor to do IO on */
        __u64   off;            /* offset into file */
-       union {
-               void    *addr;  /* buffer or iovecs */
-               __u64   __pad;
-       };
+       __u64   addr;           /* pointer to buffer or iovecs */
        __u32   len;            /* buffer size or number of iovecs */
        union {
                __kernel_rwf_t  rw_flags;
        __u32   len;            /* buffer size or number of iovecs */
        union {
                __kernel_rwf_t  rw_flags;
@@ -136,20 +133,4 @@ struct io_uring_params {
 #define IORING_REGISTER_FILES          2
 #define IORING_UNREGISTER_FILES                3
 
 #define IORING_REGISTER_FILES          2
 #define IORING_UNREGISTER_FILES                3
 
-struct io_uring_register_buffers {
-       union {
-               struct iovec *iovecs;
-               __u64 pad;
-       };
-       __u32 nr_iovecs;
-};
-
-struct io_uring_register_files {
-       union {
-               __s32 *fds;
-               __u64 pad;
-       };
-       __u32 nr_fds;
-};
-
 #endif
 #endif
index ef5d52d1f930180d083ef7b614e811e17a4dd395..da3b4d1f4a8f16bfb23ed3c37ac9a33699ffcf1a 100644 (file)
@@ -96,21 +96,15 @@ static int do_nop = 0;              /* no-op SQ ring commands */
 
 static int io_uring_register_buffers(struct submitter *s)
 {
 
 static int io_uring_register_buffers(struct submitter *s)
 {
-       struct io_uring_register_buffers reg = {
-               .iovecs = s->iovecs,
-               .nr_iovecs = DEPTH
-       };
-
        if (do_nop)
                return 0;
 
        return syscall(__NR_sys_io_uring_register, s->ring_fd,
        if (do_nop)
                return 0;
 
        return syscall(__NR_sys_io_uring_register, s->ring_fd,
-                       IORING_REGISTER_BUFFERS, &reg);
+                       IORING_REGISTER_BUFFERS, s->iovecs, DEPTH);
 }
 
 static int io_uring_register_files(struct submitter *s)
 {
 }
 
 static int io_uring_register_files(struct submitter *s)
 {
-       struct io_uring_register_files reg;
        int i;
 
        if (do_nop)
        int i;
 
        if (do_nop)
@@ -121,11 +115,9 @@ static int io_uring_register_files(struct submitter *s)
                s->fds[i] = s->files[i].real_fd;
                s->files[i].fixed_fd = i;
        }
                s->fds[i] = s->files[i].real_fd;
                s->files[i].fixed_fd = i;
        }
-       reg.fds = s->fds;
-       reg.nr_fds = s->nr_files;
 
        return syscall(__NR_sys_io_uring_register, s->ring_fd,
 
        return syscall(__NR_sys_io_uring_register, s->ring_fd,
-                       IORING_REGISTER_FILES, &reg);
+                       IORING_REGISTER_FILES, s->fds, s->nr_files);
 }
 
 static int io_uring_setup(unsigned entries, struct io_uring_params *p)
 }
 
 static int io_uring_setup(unsigned entries, struct io_uring_params *p)
@@ -187,12 +179,12 @@ static void init_io(struct submitter *s, unsigned index)
        }
        if (fixedbufs) {
                sqe->opcode = IORING_OP_READ_FIXED;
        }
        if (fixedbufs) {
                sqe->opcode = IORING_OP_READ_FIXED;
-               sqe->addr = s->iovecs[index].iov_base;
+               sqe->addr = (unsigned long) s->iovecs[index].iov_base;
                sqe->len = BS;
                sqe->buf_index = index;
        } else {
                sqe->opcode = IORING_OP_READV;
                sqe->len = BS;
                sqe->buf_index = index;
        } else {
                sqe->opcode = IORING_OP_READV;
-               sqe->addr = &s->iovecs[index];
+               sqe->addr = (unsigned long) &s->iovecs[index];
                sqe->len = 1;
                sqe->buf_index = 0;
        }
                sqe->len = 1;
                sqe->buf_index = 0;
        }