summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorCaleb Sander Mateos <csander@purestorage.com>2025-02-28 16:59:10 -0700
committerJens Axboe <axboe@kernel.dk>2025-03-04 07:17:15 -0700
commit6a53541829662c8f1357f522a1d6315179442bf7 (patch)
tree38c7509cc0d8d30aceb78aa0a3f503eee445cdd6 /io_uring
parenta1967280a1e5fb2c331f23d162b3672d64ba2549 (diff)
io_uring/rsrc: split out io_free_node() helper
Split the freeing of the io_rsrc_node from io_free_rsrc_node(), for use with nodes that haven't been fully initialized. Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Link: https://lore.kernel.org/r/20250228235916.670437-1-csander@purestorage.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/rsrc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index ee4bfdd76f6b..c8d7284f20b8 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -487,6 +487,12 @@ int io_files_update(struct io_kiocb *req, unsigned int issue_flags)
return IOU_OK;
}
+static void io_free_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
+{
+ if (!io_alloc_cache_put(&ctx->node_cache, node))
+ kvfree(node);
+}
+
void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
{
if (node->tag)
@@ -506,8 +512,7 @@ void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
break;
}
- if (!io_alloc_cache_put(&ctx->node_cache, node))
- kvfree(node);
+ io_free_node(ctx, node);
}
int io_sqe_files_unregister(struct io_ring_ctx *ctx)