diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-10-26 22:50:13 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-11-02 22:45:23 +0100 |
commit | 3597f2786b687a7f26361ce00a805ea0af41b65f (patch) | |
tree | 7b15bfaff8816407ffd8936e12ef1eb0fcc458bd /io_uring/splice.c | |
parent | io_uring: only initialize io_kiocb rsrc_nodes when needed (diff) | |
download | linux-3597f2786b687a7f26361ce00a805ea0af41b65f.tar.xz linux-3597f2786b687a7f26361ce00a805ea0af41b65f.zip |
io_uring/rsrc: unify file and buffer resource tables
For files, there's nr_user_files/file_table/file_data, and buffers have
nr_user_bufs/user_bufs/buf_data. There's no reason why file_table and
file_data can't be the same thing, and ditto for the buffer side. That
gets rid of more io_ring_ctx state that's in two spots rather than just
being in one spot, as it should be. Put all the registered file data in
one locations, and ditto on the buffer front.
This also avoids having both io_rsrc_data->nodes being an allocated
array, and ->user_bufs[] or ->file_table.nodes. There's no reason to
have this information duplicated. Keep it in one spot, io_rsrc_data,
along with how many resources are available.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/splice.c')
-rw-r--r-- | io_uring/splice.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/io_uring/splice.c b/io_uring/splice.c index f78afb575ae6..aaaddb66e90a 100644 --- a/io_uring/splice.c +++ b/io_uring/splice.c @@ -66,10 +66,10 @@ static struct file *io_splice_get_file(struct io_kiocb *req, return io_file_get_normal(req, sp->splice_fd_in); io_ring_submit_lock(ctx, issue_flags); - if (unlikely(sp->splice_fd_in >= ctx->nr_user_files)) + if (unlikely(sp->splice_fd_in >= ctx->file_table.data.nr)) goto out; - sp->splice_fd_in = array_index_nospec(sp->splice_fd_in, ctx->nr_user_files); - node = ctx->file_table.nodes[sp->splice_fd_in]; + sp->splice_fd_in = array_index_nospec(sp->splice_fd_in, ctx->file_table.data.nr); + node = ctx->file_table.data.nodes[sp->splice_fd_in]; if (node) { node->refs++; sp->rsrc_node = node; |