io_uring: add flag for allocating a fully sparse direct descriptor space
Currently to setup a fully sparse descriptor space upfront, the app needs to alloate an array of the full size and memset it to -1 and then pass that in. Make this a bit easier by allowing a flag that simply does this internally rather than needing to copy each slot separately. This works with IORING_REGISTER_FILES2 as the flag is set in struct io_uring_rsrc_register, and is only allow when the type is IORING_RSRC_FILE as this doesn't make sense for registered buffers. Reviewed-by: Hao Xu <howeyxu@tencent.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
09893e15f1
commit
a8da73a32b
2 changed files with 19 additions and 4 deletions
|
|
@ -396,9 +396,15 @@ struct io_uring_files_update {
|
|||
__aligned_u64 /* __s32 * */ fds;
|
||||
};
|
||||
|
||||
/*
|
||||
* Register a fully sparse file space, rather than pass in an array of all
|
||||
* -1 file descriptors.
|
||||
*/
|
||||
#define IORING_RSRC_REGISTER_SPARSE (1U << 0)
|
||||
|
||||
struct io_uring_rsrc_register {
|
||||
__u32 nr;
|
||||
__u32 resv;
|
||||
__u32 flags;
|
||||
__u64 resv2;
|
||||
__aligned_u64 data;
|
||||
__aligned_u64 tags;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue