]> 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)
commit50b5945e49b4b4aa5d6583a0ca352c064f128750
treed0fc3d8c3d4ac2bcccdf6065f770be66b71653b5
parent2d0e67967083a291cc1361492a6b8d9fb1e004d9
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