History

Merge tag 'for-5.7/io_uring-2020-03-29' of git://git.kernel.dk/linux-block

Pull io_uring updates from Jens Axboe: "Here are the io_uring changes for this merge window. Light on new features this time around (just splice + buffer selection), lots of cleanups, fixes, and improvements to existing support. In particular, this contains: - Cleanup fixed file update handling for stack fallback (Hillf) - Re-work of how pollable async IO is handled, we no longer require thread offload to handle that. Instead we rely using poll to drive this, with task_work execution. - In conjunction with the above, allow expendable buffer selection, so that poll+recv (for example) no longer has to be a split operation. - Make sure we honor RLIMIT_FSIZE for buffered writes - Add support for splice (Pavel) - Linked work inheritance fixes and optimizations (Pavel) - Async work fixes and cleanups (Pavel) - Improve io-wq locking (Pavel) - Hashed link write improvements (Pavel) - SETUP_IOPOLL|SETUP_SQPOLL improvements (Xiaoguang)" * tag 'for-5.7/io_uring-2020-03-29' of git://git.kernel.dk/linux-block: (54 commits) io_uring: cleanup io_alloc_async_ctx() io_uring: fix missing 'return' in comment io-wq: handle hashed writes in chains io-uring: drop 'free_pfile' in struct io_file_put io-uring: drop completion when removing file io_uring: Fix ->data corruption on re-enqueue io-wq: close cancel gap for hashed linked work io_uring: make spdxcheck.py happy io_uring: honor original task RLIMIT_FSIZE io-wq: hash dependent work io-wq: split hashing and enqueueing io-wq: don't resched if there is no work io-wq: remove duplicated cancel code io_uring: fix truncated async read/readv and write/writev retry io_uring: dual license io_uring.h uapi header io_uring: io_uring_enter(2) don't poll while SETUP_IOPOLL|SETUP_SQPOLL enabled io_uring: Fix unused function warnings io_uring: add end-of-bits marker and build time verify it io_uring: provide means of removing buffers io_uring: add IOSQE_BUFFER_SELECT support for IORING_OP_RECVMSG ...

Linus Torvalds committed 6 years ago

Commit e59cd882 parents 1592614 3d9932a12 files · +1826 −856Browse files

Showing the changes to include/uapi (1 of 12 files). Show all

Unified · Split

include/uapi/linux/io_uring.h+38−4
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1+/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
22 /*
33 * Header file for the io_uring interface.
44 *
@@ -23,7 +23,10 @@ struct io_uring_sqe { · 18 unmodified lines
2323 __u64 off; /* offset into file */
2424 __u64 addr2;
2525 };
26− __u64 addr; /* pointer to buffer or iovecs */
26+ union {
27+ __u64 addr; /* pointer to buffer or iovecs */
28+ __u64 splice_off_in;
29+ };
2730 __u32 len; /* buffer size or number of iovecs */
2831 union {
2932 __kernel_rwf_t rw_flags;
@@ -37,14 +40,21 @@ struct io_uring_sqe { · 7 unmodified lines
3740 __u32 open_flags;
3841 __u32 statx_flags;
3942 __u32 fadvise_advice;
43+ __u32 splice_flags;
4044 };
4145 __u64 user_data; /* data to be passed back at completion time */
4246 union {
4347 struct {
44− /* index into fixed buffers, if used */
45− __u16 buf_index;
48+ /* pack this to avoid bogus arm OABI complaints */
49+ union {
50+ /* index into fixed buffers, if used */
51+ __u16 buf_index;
52+ /* for grouped buffer selection */
53+ __u16 buf_group;
54+ } __attribute__((packed));
4655 /* personality to use, if used */
4756 __u16 personality;
57+ __s32 splice_fd_in;
4858 };
4959 __u64 __pad2[3];
5060 };
@@ -56,6 +66,7 @@ enum { · 5 unmodified lines
5666 IOSQE_IO_LINK_BIT,
5767 IOSQE_IO_HARDLINK_BIT,
5868 IOSQE_ASYNC_BIT,
69+ IOSQE_BUFFER_SELECT_BIT,
5970 };
6071
6172 /*
@@ -71,6 +82,8 @@ enum { · 9 unmodified lines
7182 #define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT)
7283 /* always go async */
7384 #define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT)
85+/* select buffer from sqe->buf_group */
86+#define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
7487
7588 /*
7689 * io_uring_setup() flags
@@ -113,6 +126,9 @@ enum { · 36 unmodified lines
113126 IORING_OP_RECV,
114127 IORING_OP_OPENAT2,
115128 IORING_OP_EPOLL_CTL,
129+ IORING_OP_SPLICE,
130+ IORING_OP_PROVIDE_BUFFERS,
131+ IORING_OP_REMOVE_BUFFERS,
116132
117133 /* this goes last, obviously */
118134 IORING_OP_LAST,
@@ -128,6 +144,12 @@ enum { · 9 unmodified lines
128144 */
129145 #define IORING_TIMEOUT_ABS (1U << 0)
130146
147+/*
148+ * sqe->splice_flags
149+ * extends splice(2) flags
150+ */
151+#define SPLICE_F_FD_IN_FIXED (1U << 31) /* the last bit of __u32 */
152+
131153 /*
132154 * IO completion data structure (Completion Queue Entry)
133155 */
@@ -137,6 +159,17 @@ struct io_uring_cqe { · 3 unmodified lines
137159 __u32 flags;
138160 };
139161
162+/*
163+ * cqe->flags
164+ *
165+ * IORING_CQE_F_BUFFER If set, the upper 16 bits are the buffer ID
166+ */
167+#define IORING_CQE_F_BUFFER (1U << 0)
168+
169+enum {
170+ IORING_CQE_BUFFER_SHIFT = 16,
171+};
172+
140173 /*
141174 * Magic offsets for the application to mmap the data it needs
142175 */
@@ -204,6 +237,7 @@ struct io_uring_params { · 61 unmodified lines
204237 #define IORING_FEAT_SUBMIT_STABLE (1U << 2)
205238 #define IORING_FEAT_RW_CUR_POS (1U << 3)
206239 #define IORING_FEAT_CUR_PERSONALITY (1U << 4)
240+#define IORING_FEAT_FAST_POLL (1U << 5)
207241
208242 /*
209243 * io_uring_register(2) opcodes and arguments