]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: let IORING_OP_FILES_UPDATE support choosing fixed file slots
authorXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Mon, 30 May 2022 13:15:20 +0000 (21:15 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 31 May 2022 08:50:06 +0000 (02:50 -0600)
commit3c02192c8665d03253d7881ec9a7ce59ea141ba7
treed0fc3d8c3d4ac2bcccdf6065f770be66b71653b5
parentab2925fbb1fa14e9db211d24161f5209fb257db0
io_uring: let IORING_OP_FILES_UPDATE support choosing fixed file slots

One big issue with the file registration feature is that it needs user
space apps to maintain free slot info about io_uring's fixed file table,
which really is a burden for development. io_uring now supports choosing
free file slot for user space apps by using IORING_FILE_INDEX_ALLOC flag
in accept, open, and socket operations, but they need the app to use
direct accept or direct open, which not all apps are prepared to use yet.

To support apps that still need real fds, make use of the registration
feature easier. Let IORING_OP_FILES_UPDATE support choosing fixed file
slots, which will store picked fixed files slots in fd array and let cqe
return the number of slots allocated.

Suggested-by: Hao Xu <howeyxu@tencent.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
[axboe: move flag to uapi io_uring header, change goto to break, init]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
include/uapi/linux/io_uring.h