summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-04-01 15:43:47 +0100
committerJens Axboe <axboe@kernel.dk>2021-04-11 19:30:34 -0600
commit28a9fe2521348ee350b65ae89e63c1def87b0cb6 (patch)
treebd7f797e997c468c8fe2f6243a218d4bd6f41627 /fs/io_uring.c
parenta7f0ed5acdc9ce251c66b9380e08766e59fa4ee8 (diff)
downloadlwn-28a9fe2521348ee350b65ae89e63c1def87b0cb6.tar.gz
lwn-28a9fe2521348ee350b65ae89e63c1def87b0cb6.zip
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>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 81298999fd93..59e666151754 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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)
{