t/zbd: avoid test case 31 failure with small devices
[fio.git] / t / io_uring.c
index 46b153dcbefc32ee778f75023d0cb69cd680e216..aa6e09e9edf94b3438e434dac0f4e21bb113d964 100644 (file)
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <pthread.h>
 #include <sched.h>
+#include <libgen.h>
 
 #include "../arch/arch.h"
 #include "../os/os.h"
@@ -819,7 +820,7 @@ static void set_affinity(struct submitter *s)
 #endif
 }
 
-static int detect_node(struct submitter *s, const char *name)
+static int detect_node(struct submitter *s, char *name)
 {
 #ifdef CONFIG_LIBNUMA
        const char *base = basename(name);
@@ -973,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;
 }