Skip to content

Commit fff4db7

Browse files
isilenceaxboe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/95caf17fe837e67bd1f878395f07049062a010d4.1619356238.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 724cb4f commit fff4db7

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

fs/io_uring.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7028,33 +7028,6 @@ static void io_free_file_tables(struct io_file_table *table, unsigned nr_files)
70287028
table->files = NULL;
70297029
}
70307030

7031-
static void __io_sqe_files_unregister(struct io_ring_ctx *ctx)
7032-
{
7033-
#if defined(CONFIG_UNIX)
7034-
if (ctx->ring_sock) {
7035-
struct sock *sock = ctx->ring_sock->sk;
7036-
struct sk_buff *skb;
7037-
7038-
while ((skb = skb_dequeue(&sock->sk_receive_queue)) != NULL)
7039-
kfree_skb(skb);
7040-
}
7041-
#else
7042-
int i;
7043-
7044-
for (i = 0; i < ctx->nr_user_files; i++) {
7045-
struct file *file;
7046-
7047-
file = io_file_from_index(ctx, i);
7048-
if (file)
7049-
fput(file);
7050-
}
7051-
#endif
7052-
io_free_file_tables(&ctx->file_table, ctx->nr_user_files);
7053-
kfree(ctx->file_data);
7054-
ctx->file_data = NULL;
7055-
ctx->nr_user_files = 0;
7056-
}
7057-
70587031
static inline void io_rsrc_ref_lock(struct io_ring_ctx *ctx)
70597032
{
70607033
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,
71577130
return data;
71587131
}
71597132

7133+
static void __io_sqe_files_unregister(struct io_ring_ctx *ctx)
7134+
{
7135+
#if defined(CONFIG_UNIX)
7136+
if (ctx->ring_sock) {
7137+
struct sock *sock = ctx->ring_sock->sk;
7138+
struct sk_buff *skb;
7139+
7140+
while ((skb = skb_dequeue(&sock->sk_receive_queue)) != NULL)
7141+
kfree_skb(skb);
7142+
}
7143+
#else
7144+
int i;
7145+
7146+
for (i = 0; i < ctx->nr_user_files; i++) {
7147+
struct file *file;
7148+
7149+
file = io_file_from_index(ctx, i);
7150+
if (file)
7151+
fput(file);
7152+
}
7153+
#endif
7154+
io_free_file_tables(&ctx->file_table, ctx->nr_user_files);
7155+
kfree(ctx->file_data);
7156+
ctx->file_data = NULL;
7157+
ctx->nr_user_files = 0;
7158+
}
7159+
71607160
static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
71617161
{
71627162
int ret;

0 commit comments

Comments
 (0)