Skip to content

Commit

Permalink
t/io_uring: only calculate per-file depth if we have files
Browse files Browse the repository at this point in the history
If NOPs are used, then no files exist, and hence the app will throw
a floating point error when trying to divide by zero.

Fixes: 6067863 ("t/io_uring: pre-calculate per-file depth")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Apr 17, 2024
1 parent cf9c8b5 commit e0bb44a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion t/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,9 @@ static int setup_ring(struct submitter *s)
for (i = 0; i < p.sq_entries; i++)
sring->array[i] = i;

s->per_file_depth = (depth + s->nr_files - 1) / s->nr_files;
s->per_file_depth = INT_MAX;
if (s->nr_files)
s->per_file_depth = (depth + s->nr_files - 1) / s->nr_files;
return 0;
}

Expand Down

0 comments on commit e0bb44a

Please sign in to comment.