Commit 6a535418 authored by Caleb Sander Mateos's avatar Caleb Sander Mateos Committed by Jens Axboe
Browse files

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: default avatarCaleb Sander Mateos <csander@purestorage.com>
Link: https://lore.kernel.org/r/20250228235916.670437-1-csander@purestorage.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a1967280
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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)