diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-04-01 15:43:45 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-04-11 19:30:34 -0600 |
commit | e7c78371bbf749087ff6b1f37c0d60f0ae82572c (patch) | |
tree | 4bf34c27e91d1a3deb3aaff92a59f7b591445dcd /fs/io_uring.c | |
parent | 40ae0ff70fb1379cb00041ef4061681e5e84e7f9 (diff) | |
download | lwn-e7c78371bbf749087ff6b1f37c0d60f0ae82572c.tar.gz lwn-e7c78371bbf749087ff6b1f37c0d60f0ae82572c.zip |
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>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index c7875bb9b126..2ac69d2ad4b3 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -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; |