io_uring: reuse io_rsrc_node_destroy()
Reuse io_rsrc_node_destroy() in __io_rsrc_put_work(). Also move it to a more appropriate place -- to the other node routines, and remove forward declaration. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/cccafba41aee1e5bb59988704885b1340aef3a27.1617287883.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a7f0ed5acd
commit
28a9fe2521
@ -1028,7 +1028,6 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx,
|
||||
struct task_struct *task,
|
||||
struct files_struct *files);
|
||||
static void io_uring_cancel_sqpoll(struct io_ring_ctx *ctx);
|
||||
static void io_rsrc_node_destroy(struct io_rsrc_node *ref_node);
|
||||
static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx);
|
||||
static void io_ring_file_put(struct io_ring_ctx *ctx, struct io_rsrc_put *prsrc);
|
||||
|
||||
@ -7093,6 +7092,12 @@ static inline void io_rsrc_ref_unlock(struct io_ring_ctx *ctx)
|
||||
spin_unlock_bh(&ctx->rsrc_ref_lock);
|
||||
}
|
||||
|
||||
static void io_rsrc_node_destroy(struct io_rsrc_node *ref_node)
|
||||
{
|
||||
percpu_ref_exit(&ref_node->refs);
|
||||
kfree(ref_node);
|
||||
}
|
||||
|
||||
static void io_rsrc_node_switch(struct io_ring_ctx *ctx,
|
||||
struct io_rsrc_data *data_to_kill)
|
||||
{
|
||||
@ -7538,8 +7543,7 @@ static void __io_rsrc_put_work(struct io_rsrc_node *ref_node)
|
||||
kfree(prsrc);
|
||||
}
|
||||
|
||||
percpu_ref_exit(&ref_node->refs);
|
||||
kfree(ref_node);
|
||||
io_rsrc_node_destroy(ref_node);
|
||||
percpu_ref_put(&rsrc_data->refs);
|
||||
}
|
||||
|
||||
@ -7607,12 +7611,6 @@ static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx)
|
||||
return ref_node;
|
||||
}
|
||||
|
||||
static void io_rsrc_node_destroy(struct io_rsrc_node *ref_node)
|
||||
{
|
||||
percpu_ref_exit(&ref_node->refs);
|
||||
kfree(ref_node);
|
||||
}
|
||||
|
||||
static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,
|
||||
unsigned nr_args)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user