diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-04-25 14:32:15 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-04-25 10:14:04 -0600 |
commit | fff4db76be297bd4124a503948435a3917d7a702 (patch) | |
tree | 042e4f2058f488ae8d678f10827da9e260ef49ad /fs/io_uring.c | |
parent | 724cb4f9ec905173f32c5bd08fec26abaecc6a1d (diff) | |
download | lwn-fff4db76be297bd4124a503948435a3917d7a702.tar.gz lwn-fff4db76be297bd4124a503948435a3917d7a702.zip |
io_uring: move __io_sqe_files_unregister
A preparation patch moving __io_sqe_files_unregister() definition closer
to other "files" functions without any modification.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/95caf17fe837e67bd1f878395f07049062a010d4.1619356238.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.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 40f38256499c..0a35881cdd0b 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7028,33 +7028,6 @@ static void io_free_file_tables(struct io_file_table *table, unsigned nr_files) table->files = NULL; } -static void __io_sqe_files_unregister(struct io_ring_ctx *ctx) -{ -#if defined(CONFIG_UNIX) - if (ctx->ring_sock) { - struct sock *sock = ctx->ring_sock->sk; - struct sk_buff *skb; - - while ((skb = skb_dequeue(&sock->sk_receive_queue)) != NULL) - kfree_skb(skb); - } -#else - int i; - - for (i = 0; i < ctx->nr_user_files; i++) { - struct file *file; - - file = io_file_from_index(ctx, i); - if (file) - fput(file); - } -#endif - io_free_file_tables(&ctx->file_table, ctx->nr_user_files); - kfree(ctx->file_data); - ctx->file_data = NULL; - ctx->nr_user_files = 0; -} - static inline void io_rsrc_ref_lock(struct io_ring_ctx *ctx) { spin_lock_bh(&ctx->rsrc_ref_lock); @@ -7157,6 +7130,33 @@ static struct io_rsrc_data *io_rsrc_data_alloc(struct io_ring_ctx *ctx, return data; } +static void __io_sqe_files_unregister(struct io_ring_ctx *ctx) +{ +#if defined(CONFIG_UNIX) + if (ctx->ring_sock) { + struct sock *sock = ctx->ring_sock->sk; + struct sk_buff *skb; + + while ((skb = skb_dequeue(&sock->sk_receive_queue)) != NULL) + kfree_skb(skb); + } +#else + int i; + + for (i = 0; i < ctx->nr_user_files; i++) { + struct file *file; + + file = io_file_from_index(ctx, i); + if (file) + fput(file); + } +#endif + io_free_file_tables(&ctx->file_table, ctx->nr_user_files); + kfree(ctx->file_data); + ctx->file_data = NULL; + ctx->nr_user_files = 0; +} + static int io_sqe_files_unregister(struct io_ring_ctx *ctx) { int ret; |