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: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/002889ce4de7baf287f2b010eef86ffe889174c6.1617287883.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Родитель
40ae0ff70f
Коммит
e7c78371bb
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче