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>
pull/1188/head
Caleb Sander Mateos 2025-02-28 16:59:10 -07:00 committed by Jens Axboe
parent a1967280a1
commit 6a53541829
1 changed files with 7 additions and 2 deletions

View File

@ -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)