Skip to content

Commit

Permalink
io_uring: return back rsrc data free helper
Browse files Browse the repository at this point in the history
Add io_rsrc_data_free() helper for destroying rsrc_data, easier for
search and the function will get more stuff to destroy shortly.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/562d1d53b5ff184f15b8949a63d76ef19c4ba9ec.1619356238.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Apr 25, 2021
1 parent fff4db7 commit 44b31f2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -7114,6 +7114,11 @@ static int io_rsrc_ref_quiesce(struct io_rsrc_data *data, struct io_ring_ctx *ct
return ret;
}

static void io_rsrc_data_free(struct io_rsrc_data *data)
{
kfree(data);
}

static struct io_rsrc_data *io_rsrc_data_alloc(struct io_ring_ctx *ctx,
rsrc_put_fn *do_put)
{
Expand Down Expand Up @@ -7152,7 +7157,7 @@ static void __io_sqe_files_unregister(struct io_ring_ctx *ctx)
}
#endif
io_free_file_tables(&ctx->file_table, ctx->nr_user_files);
kfree(ctx->file_data);
io_rsrc_data_free(ctx->file_data);
ctx->file_data = NULL;
ctx->nr_user_files = 0;
}
Expand Down Expand Up @@ -7629,7 +7634,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,
io_free_file_tables(&ctx->file_table, nr_args);
ctx->nr_user_files = 0;
out_free:
kfree(ctx->file_data);
io_rsrc_data_free(ctx->file_data);
ctx->file_data = NULL;
return ret;
}
Expand Down

0 comments on commit 44b31f2

Please sign in to comment.