From: Caleb Sander Mateos Date: Fri, 28 Feb 2025 23:59:10 +0000 (-0700) Subject: io_uring/rsrc: split out io_free_node() helper X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6a53541829662c8f1357f522a1d6315179442bf7;p=users%2Fjedix%2Flinux-maple.git 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 Link: https://lore.kernel.org/r/20250228235916.670437-1-csander@purestorage.com Signed-off-by: Jens Axboe --- diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index ee4bfdd76f6bc..c8d7284f20b8c 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)