diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-06-25 11:55:38 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-07-24 18:39:16 -0600 |
commit | 6e73dffbb93cb8797cd4e42e98d837edf0f1a967 (patch) | |
tree | a1ea7810d2221f23c3bc0f673e6cc6a23262b5c7 /io_uring/rsrc.c | |
parent | e6130eba8a848a7a6ba6c534bd8f6d60749ae1a9 (diff) | |
download | linux-6e73dffbb93cb8797cd4e42e98d837edf0f1a967.tar.gz linux-6e73dffbb93cb8797cd4e42e98d837edf0f1a967.tar.bz2 linux-6e73dffbb93cb8797cd4e42e98d837edf0f1a967.zip |
io_uring: let to set a range for file slot allocation
From recently io_uring provides an option to allocate a file index for
operation registering fixed files. However, it's utterly unusable with
mixed approaches when for a part of files the userspace knows better
where to place it, as it may race and users don't have any sane way to
pick a slot and hoping it will not be taken.
Let the userspace to register a range of fixed file slots in which the
auto-allocation happens. The use case is splittting the fixed table in
two parts, where on of them is used for auto-allocation and another for
slot-specified operations.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/66ab0394e436f38437cf7c44676e1920d09687ad.1656154403.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/rsrc.c')
-rw-r--r-- | io_uring/rsrc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 706fa020505b..d2e589c703d0 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1012,6 +1012,8 @@ int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, io_file_bitmap_set(&ctx->file_table, i); } + /* default it to the whole table */ + io_file_table_set_alloc_range(ctx, 0, ctx->nr_user_files); io_rsrc_node_switch(ctx, NULL); return 0; fail: |