summaryrefslogtreecommitdiffstats
path: root/io_uring/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2023-04-11 13:06:07 +0200
committerJens Axboe <axboe@kernel.dk>2023-04-12 20:09:41 +0200
commit2933ae6eaa05e8db6ad33a3ca12af18d2a25358c (patch)
tree7ff931f2b1017b3a02df2e2004b5520c8a92ca95 /io_uring/io_uring.c
parentio_uring/rsrc: zero node's rsrc data on alloc (diff)
downloadlinux-2933ae6eaa05e8db6ad33a3ca12af18d2a25358c.tar.xz
linux-2933ae6eaa05e8db6ad33a3ca12af18d2a25358c.zip
io_uring/rsrc: refactor io_rsrc_node_switch
We use io_rsrc_node_switch() coupled with io_rsrc_node_switch_start() for a bunch of cases including initialising ctx->rsrc_node, i.e. by passing NULL instead of rsrc_data. Leave it to only deal with actual node changing. For that, first remove it from io_uring_create() and add a function allocating the first node. Then also remove all calls to io_rsrc_node_switch() from files/buffers register as we already have a node installed and it does essentially nothing. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/d146fe306ff98b1a5a60c997c252534f03d423d7.1681210788.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.c')
-rw-r--r--io_uring/io_uring.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 075bae8a2bb1..9083a8466ebf 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3881,11 +3881,10 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
ret = io_sq_offload_create(ctx, p);
if (ret)
goto err;
- /* always set a rsrc node */
- ret = io_rsrc_node_switch_start(ctx);
+
+ ret = io_rsrc_init(ctx);
if (ret)
goto err;
- io_rsrc_node_switch(ctx, NULL);
memset(&p->sq_off, 0, sizeof(p->sq_off));
p->sq_off.head = offsetof(struct io_rings, sq.head);