summaryrefslogtreecommitdiffstats
path: root/io_uring/rsrc.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-10-26 22:50:13 +0200
committerJens Axboe <axboe@kernel.dk>2024-11-02 22:45:23 +0100
commit3597f2786b687a7f26361ce00a805ea0af41b65f (patch)
tree7b15bfaff8816407ffd8936e12ef1eb0fcc458bd /io_uring/rsrc.h
parentio_uring: only initialize io_kiocb rsrc_nodes when needed (diff)
downloadlinux-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/rsrc.h')
-rw-r--r--io_uring/rsrc.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h
index 48f712488f6b..569ea9ce1405 100644
--- a/io_uring/rsrc.h
+++ b/io_uring/rsrc.h
@@ -13,11 +13,6 @@ enum {
IORING_RSRC_BUFFER = 1,
};
-struct io_rsrc_data {
- unsigned int nr;
- struct io_rsrc_node **nodes;
-};
-
struct io_rsrc_node {
struct io_ring_ctx *ctx;
int refs;
@@ -50,6 +45,8 @@ struct io_imu_folio_data {
struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx, int type);
void io_free_rsrc_node(struct io_rsrc_node *node);
+void io_rsrc_data_free(struct io_rsrc_data *data);
+int io_rsrc_data_alloc(struct io_rsrc_data *data, unsigned nr);
int io_import_fixed(int ddir, struct iov_iter *iter,
struct io_mapped_ubuf *imu,