From e0bb44a5b2a67695f0b940772c70f678b323ec54 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 17 Apr 2024 16:33:28 -0600 Subject: [PATCH] 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 --- t/io_uring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.25.1