Add IORING_FEAT_FILES_SKIP feature flag
PATCH 1/1 Add IORING_FEAT_FILES_SKIP feature flag
This is aliased to IORING_FEAT_NATIVE_WORKERS, which was shipped in the same kernel release. A separate flag is useful because the features are unrelated, so user code testing for IORING_FEAT_NATIVE_WORKERS before using FILES_SKIP is not very obvious in intent.
--- man/io_uring_register.2 | 10 ++++++++-- src/include/liburing/io_uring.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
man/io_uring_register.2 +8 -2
@@ -156,8 +156,14 @@ since 5.5. File descriptors can be skipped if they are set to .B IORING_REGISTER_FILES_SKIP. Skipping an fd will not touch the file associated with the previous -fd at that index. Available since 5.12. - +fd at that index. Available since 5.12. Availability of this feature is +indicated by the presence of the +.B IORING_FEAT_FILES_SKIP +bit in the +.I features +field of the +.I io_uring_params +structure. .TP .B IORING_UNREGISTER_FILES
src/include/liburing/io_uring.h +1 -0
@@ -285,6 +285,7 @@ struct io_uring_params {#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)#define IORING_FEAT_EXT_ARG (1U << 8)#define IORING_FEAT_NATIVE_WORKERS (1U << 9) +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERS/* * io_uring_register(2) opcodes and arguments
Signature · 1 line
2.31.1
Jens Axboe
maintainerQuoted 37 lines · Drew DeVault
This is aliased to
IORING_FEAT_NATIVE_WORKERS, which was shipped in the same kernel release. A separate flag is useful because the features are unrelated, so user code testing forIORING_FEAT_NATIVE_WORKERSbefore usingFILES_SKIPis not very obvious in intent.Signed-off-by Drew DeVault <[email protected]>--- man/io_uring_register.2 | 10 ++++++++-- src/include/liburing/io_uring.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)man/io_uring_register.2 +8
-2@@ -156,8 +156,14 @@ since 5.5. File descriptors can be skipped if they are set to .B IORING_REGISTER_FILES_SKIP. Skipping an fd will not touch the file associated with the previous -fd at that index. Available since 5.12. - +fd at that index. Available since 5.12. Availability of this feature is +indicated by the presence of the +.B IORING_FEAT_FILES_SKIP +bit in the +.I features +field of the +.I io_uring_params +structure. .TP .B IORING_UNREGISTER_FILESsrc/include/liburing/io_uring.h +0
-0
src/include/liburing/io_uring.h struct io_uring_params { · line 288
Quoted 4 lines
src/include/liburing/io_uring.h +1
-0@@ -285,6 +285,7 @@ struct io_uring_params {#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)#define IORING_FEAT_EXT_ARG (1U << 8)#define IORING_FEAT_NATIVE_WORKERS (1U << 9) +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERS
I don't think this is a great idea. It can be used as a "probably we have this feature" in userspace, but I don't like aliasing on the kernel side.
Signature · 1 line
Jens Axboe
Quoted 5 lines · Jens Axboe
Quoted 5 lines
src/include/liburing/io_uring.h +0
-0@@ -285,6 +285,7 @@ struct io_uring_params {
Quoted 8 lines
src/include/liburing/io_uring.h struct io_uring_params { · line 288
Quoted 4 lines
src/include/liburing/io_uring.h +1
-0#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)#define IORING_FEAT_EXT_ARG (1U << 8)#define IORING_FEAT_NATIVE_WORKERS (1U << 9) +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERSI don't think this is a great idea. It can be used as a "probably we have this feature" in userspace, but I don't like aliasing on the kernel side.
This patch is for liburing, following the feedback on the kernel patch (which didn't alias, but regardless).
Quoted 15 lines · Drew DeVault
Quoted 5 lines · Jens Axboe
Quoted 5 lines
src/include/liburing/io_uring.h +0
-0@@ -285,6 +285,7 @@ struct io_uring_params {Quoted 8 lines
src/include/liburing/io_uring.h struct io_uring_params { · line 288
Quoted 4 lines
src/include/liburing/io_uring.h +1
-0#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)#define IORING_FEAT_EXT_ARG (1U << 8)#define IORING_FEAT_NATIVE_WORKERS (1U << 9) +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERSI don't think this is a great idea. It can be used as a "probably we have this feature" in userspace, but I don't like aliasing on the kernel side.
Quoted 2 lines
This patch is for liburing, following the feedback on the kernel patch (which didn't alias, but regardless).
This file is a copy (almost) of the kernel's uapi header, so better be off this file and have naming that wouldn't alias with names in this header.
I think that's the problem Jens mean. Jens, is it? And I do still believe it's a better way to not have an itchy one release gap between actual feature introduction and new feat flag.
Signature · 1 line
Pavel Begunkov
Quoted 19 lines · Pavel Begunkov
Quoted 15 lines · Drew DeVault
Quoted 5 lines · Jens Axboe
Quoted 5 lines
src/include/liburing/io_uring.h +0
-0@@ -285,6 +285,7 @@ struct io_uring_params {Quoted 8 lines
src/include/liburing/io_uring.h struct io_uring_params { · line 288
Quoted 4 lines
src/include/liburing/io_uring.h +1
-0#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)#define IORING_FEAT_EXT_ARG (1U << 8)#define IORING_FEAT_NATIVE_WORKERS (1U << 9) +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERSI don't think this is a great idea. It can be used as a "probably we have this feature" in userspace, but I don't like aliasing on the kernel side.
Quoted 2 lines
This patch is for liburing, following the feedback on the kernel patch (which didn't alias, but regardless).
Quoted 7 lines
This file is a copy (almost) of the kernel's uapi header, so better be off this file and have naming that wouldn't alias with names in this header.
I think that's the problem Jens mean. Jens, is it? And I do still believe it's a better way to not have an itchy one release gap between actual feature introduction and new feat flag.
It does itch, but I don't think it's actually wrong, per-se. Unless we expect features to be removed or optionally available, it might make sense to have used an incrementing number rather than a bitfield.
What should userspace programs do if they're not sure if they can use FILES_SKIP? What was the previous behavior if -2 is used? I'm guessing it was EINVAL, EBADF, something like that.