diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-01-26 13:51:09 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-01 10:02:43 -0700 |
commit | 67973b933e347c38478b591d6c9dc076bea7c9dc (patch) | |
tree | 6fff919b9bfe96655cbf2aaa88fbe907615253e0 /fs | |
parent | 7c6607313f032b73638a6f752cb4adf50ba947cf (diff) | |
download | linux-67973b933e347c38478b591d6c9dc076bea7c9dc.tar.bz2 |
io_uring: cleanup files_update looping
Replace a while with a simple for loop, that looks way more natural, and
enables us to use "continue" as indexes are no more updated by hand in
the end of the loop.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/io_uring.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 6d45a0975d9c..0ca99bd5c316 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8028,9 +8028,8 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, return -ENOMEM; init_fixed_file_ref_node(ctx, ref_node); - done = 0; fds = u64_to_user_ptr(up->data); - while (nr_args) { + for (done = 0; done < nr_args; done++) { struct fixed_rsrc_table *table; unsigned index; @@ -8039,7 +8038,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, err = -EFAULT; break; } - i = array_index_nospec(up->offset, ctx->nr_user_files); + i = array_index_nospec(up->offset + done, ctx->nr_user_files); table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT]; index = i & IORING_FILE_TABLE_MASK; if (table->files[index]) { @@ -8077,9 +8076,6 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, break; } } - nr_args--; - done++; - up->offset++; } if (needs_switch) { |