t/io_uring: fixes
[fio.git] / t / io_uring.c
index 205769cff12bdf590c675bf97b27a3a5876d2146..0545a1dd680c64f00aaa68c31d55839235058c39 100644 (file)
@@ -311,7 +311,7 @@ static void *submitter_fn(void *data)
 submit_more:
                to_submit = prepped;
 submit:
-               if (to_submit && (s->inflight + to_submit < DEPTH))
+               if (to_submit && (s->inflight + to_submit <= DEPTH))
                        to_wait = 0;
                else
                        to_wait = min(s->inflight + to_submit, BATCH_COMPLETE);
@@ -338,9 +338,10 @@ submit:
                do {
                        int r;
                        r = reap_events(s);
-                       if (r == -1)
+                       if (r == -1) {
+                               s->finish = 1;
                                break;
-                       else if (r > 0)
+                       else if (r > 0)
                                this_reap += r;
                } while (sq_thread_poll && this_reap < to_wait);
                s->reaps += this_reap;
@@ -406,7 +407,7 @@ static int setup_ring(struct submitter *s)
 
        memset(&p, 0, sizeof(p));
 
-       if (polled)
+       if (polled && !do_nop)
                p.flags |= IORING_SETUP_IOPOLL;
        if (sq_thread_poll) {
                p.flags |= IORING_SETUP_SQPOLL;
@@ -475,6 +476,7 @@ static void file_depths(char *buf)
        char *p;
        int i;
 
+       buf[0] = '\0';
        p = buf;
        for (i = 0; i < s->nr_files; i++) {
                struct file *f = &s->files[i];