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>
This commit is contained in:
committed by
Jens Axboe
parent
7c6607313f
commit
67973b933e
@@ -8028,9 +8028,8 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
init_fixed_file_ref_node(ctx, ref_node);
|
init_fixed_file_ref_node(ctx, ref_node);
|
||||||
|
|
||||||
done = 0;
|
|
||||||
fds = u64_to_user_ptr(up->data);
|
fds = u64_to_user_ptr(up->data);
|
||||||
while (nr_args) {
|
for (done = 0; done < nr_args; done++) {
|
||||||
struct fixed_rsrc_table *table;
|
struct fixed_rsrc_table *table;
|
||||||
unsigned index;
|
unsigned index;
|
||||||
|
|
||||||
@@ -8039,7 +8038,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
|
|||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
break;
|
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];
|
table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT];
|
||||||
index = i & IORING_FILE_TABLE_MASK;
|
index = i & IORING_FILE_TABLE_MASK;
|
||||||
if (table->files[index]) {
|
if (table->files[index]) {
|
||||||
@@ -8077,9 +8076,6 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nr_args--;
|
|
||||||
done++;
|
|
||||||
up->offset++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needs_switch) {
|
if (needs_switch) {
|
||||||
|
|||||||
Reference in New Issue
Block a user