在 2022/5/9 下午11:50, Jens Axboe 写道:
Hi, Currently using direct descriptors with open or accept requires the application to manage the descriptor space, picking which slot to use for any given file. However, there are cases where it's useful to just get a direct descriptor and not care about which value it is, instead just return it like a normal open or accept would. This will also be useful for multishot accept support, where allocated direct descriptors are a requirement to make that feature work with these kinds of files. This adds support for allocating a new fixed descriptor. This is chosen by passing in IORING_FILE_INDEX_ALLOC as the fixed slot, which is beyond any valid value for the file_index. Can also be found here: https://git.kernel.dk/cgit/linux-block/log/?h=for-5.19/io_uring-fixed-alloc fs/io_uring.c | 113 +++++++++++++++++++++++++++++++--- include/uapi/linux/io_uring.h | 17 ++++- 2 files changed, 120 insertions(+), 10 deletions(-) v2: - Fix unnecessary clear (Hao) - Add define for allocating a descriptor rather than use UINT_MAX. - Add patch bumping max file table size to 1M (from 32K) - Add ability to register a sparse file table upfront rather then have the application pass in a big array of -1.
Reviewed-by: Hao Xu <howeyxu@xxxxxxxxxxx>