Skip to content

Commit f432c8c

Browse files
Christoph Hellwigaxboe
authored andcommitted
io_uring: use io_file_from_index in io_msg_grab_file
Use io_file_from_index instead of open coding it. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20230620113235.920399-8-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 60a666f commit f432c8c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

io_uring/msg_ring.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,12 @@ static struct file *io_msg_grab_file(struct io_kiocb *req, unsigned int issue_fl
162162
struct io_msg *msg = io_kiocb_to_cmd(req, struct io_msg);
163163
struct io_ring_ctx *ctx = req->ctx;
164164
struct file *file = NULL;
165-
unsigned long file_ptr;
166165
int idx = msg->src_fd;
167166

168167
io_ring_submit_lock(ctx, issue_flags);
169168
if (likely(idx < ctx->nr_user_files)) {
170169
idx = array_index_nospec(idx, ctx->nr_user_files);
171-
file_ptr = io_fixed_file_slot(&ctx->file_table, idx)->file_ptr;
172-
file = (struct file *) (file_ptr & FFS_MASK);
170+
file = io_file_from_index(&ctx->file_table, idx);
173171
if (file)
174172
get_file(file);
175173
}

0 commit comments

Comments
 (0)