]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
io_uring/rsrc: split out io_free_node() helper
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 28 Feb 2025 23:59:10 +0000 (16:59 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 4 Mar 2025 14:17:15 +0000 (07:17 -0700)
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>
io_uring/rsrc.c

index ee4bfdd76f6bc28115920c858bd1a56f59dd5a66..c8d7284f20b8c53674f970e650ad1ed336b876d3 100644 (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)