From: Jens Axboe Date: Wed, 17 Apr 2024 22:33:28 +0000 (-0600) Subject: t/io_uring: only calculate per-file depth if we have files X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=e0bb44a5b2a67695f0b940772c70f678b323ec54;p=fio.git t/io_uring: only calculate per-file depth if we have files 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: 6067863c7016 ("t/io_uring: pre-calculate per-file depth") Signed-off-by: Jens Axboe --- diff --git a/t/io_uring.c b/t/io_uring.c index 18e8b38e..aa6e09e9 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -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; }