提交 e7c78371 编写于 作者: P Pavel Begunkov 提交者: Jens Axboe

io_uring: refactor io_queue_rsrc_removal()

Pass rsrc_node into io_queue_rsrc_removal() explicitly. Just a
simple preparation patch, makes following changes nicer.
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/002889ce4de7baf287f2b010eef86ffe889174c6.1617287883.git.asml.silence@gmail.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
上级 40ae0ff7
......@@ -7754,27 +7754,20 @@ static int io_sqe_file_register(struct io_ring_ctx *ctx, struct file *file,
#endif
}
static int io_queue_rsrc_removal(struct io_rsrc_data *data, void *rsrc)
static int io_queue_rsrc_removal(struct io_rsrc_data *data,
struct io_rsrc_node *node, void *rsrc)
{
struct io_rsrc_put *prsrc;
struct io_rsrc_node *ref_node = data->node;
prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL);
if (!prsrc)
return -ENOMEM;
prsrc->rsrc = rsrc;
list_add(&prsrc->list, &ref_node->rsrc_list);
list_add(&prsrc->list, &node->rsrc_list);
return 0;
}
static inline int io_queue_file_removal(struct io_rsrc_data *data,
struct file *file)
{
return io_queue_rsrc_removal(data, (void *)file);
}
static int __io_sqe_files_update(struct io_ring_ctx *ctx,
struct io_uring_rsrc_update *up,
unsigned nr_args)
......@@ -7809,7 +7802,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
if (*file_slot) {
file = (struct file *) ((unsigned long) *file_slot & FFS_MASK);
err = io_queue_file_removal(data, file);
err = io_queue_rsrc_removal(data, data->node, file);
if (err)
break;
*file_slot = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册