x86-64: add system call definitions
[fio.git] / engines / io_uring.c
index 8b8f35f1e6644b4cf4481956684a46b32de2a8f0..a2533c88e6a2c0bfa819dd782e37888f6f0bc960 100644 (file)
@@ -692,9 +692,22 @@ static int fio_ioring_queue_init(struct thread_data *td)
                }
        }
 
+       /*
+        * Clamp CQ ring size at our SQ ring size, we don't need more entries
+        * than that.
+        */
+       p.flags |= IORING_SETUP_CQSIZE;
+       p.cq_entries = depth;
+
+retry:
        ret = syscall(__NR_io_uring_setup, depth, &p);
-       if (ret < 0)
+       if (ret < 0) {
+               if (errno == EINVAL && p.flags & IORING_SETUP_CQSIZE) {
+                       p.flags &= ~IORING_SETUP_CQSIZE;
+                       goto retry;
+               }
                return ret;
+       }
 
        ld->ring_fd = ret;