Commit 6802535d authored by Bijan Mottahedeh's avatar Bijan Mottahedeh Committed by Jens Axboe
Browse files

io_uring: split alloc_fixed_file_ref_node



Split alloc_fixed_file_ref_node into resource generic/specific parts,
to be leveraged for fixed buffers.

Signed-off-by: default avatarBijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Reviewed-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 2a63b2d9
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -7799,7 +7799,7 @@ static void io_rsrc_data_ref_zero(struct percpu_ref *ref)
		queue_delayed_work(system_wq, &ctx->rsrc_put_work, delay);
}

static struct fixed_rsrc_ref_node *alloc_fixed_file_ref_node(
static struct fixed_rsrc_ref_node *alloc_fixed_rsrc_ref_node(
			struct io_ring_ctx *ctx)
{
	struct fixed_rsrc_ref_node *ref_node;
@@ -7815,9 +7815,21 @@ static struct fixed_rsrc_ref_node *alloc_fixed_file_ref_node(
	}
	INIT_LIST_HEAD(&ref_node->node);
	INIT_LIST_HEAD(&ref_node->rsrc_list);
	ref_node->done = false;
	return ref_node;
}

static struct fixed_rsrc_ref_node *alloc_fixed_file_ref_node(
			struct io_ring_ctx *ctx)
{
	struct fixed_rsrc_ref_node *ref_node;

	ref_node = alloc_fixed_rsrc_ref_node(ctx);
	if (!ref_node)
		return NULL;

	ref_node->rsrc_data = ctx->file_data;
	ref_node->rsrc_put = io_ring_file_put;
	ref_node->done = false;
	return ref_node;
}