-static int polled = 0; /* use IO polling */
-static int fixedbufs = 0; /* use fixed user buffers */
-static int buffered = 1; /* use buffered IO, not O_DIRECT */
-static int sq_thread = 0; /* use kernel submission thread */
-static int sq_thread_cpu = 0; /* pin above thread to this CPU */
+static int polled = 1; /* use IO polling */
+static int fixedbufs = 1; /* use fixed user buffers */
+static int buffered = 0; /* use buffered IO, not O_DIRECT */
+static int sq_thread_poll = 0; /* use kernel submission/poller thread */
+static int sq_thread_cpu = -1; /* pin above thread to this CPU */
+static int do_nop = 0; /* no-op SQ ring commands */
+
+static int io_uring_register_buffers(struct submitter *s)
+{
+ struct io_uring_register_buffers reg = {
+ .iovecs = s->iovecs,
+ .nr_iovecs = DEPTH
+ };
+
+ if (do_nop)
+ return 0;
+
+ return syscall(__NR_sys_io_uring_register, s->ring_fd,
+ IORING_REGISTER_BUFFERS, ®);
+}
+
+static int io_uring_register_files(struct submitter *s)
+{
+ struct io_uring_register_files reg;
+ int i;
+
+ if (do_nop)
+ return 0;
+
+ s->fds = calloc(s->nr_files, sizeof(__s32));
+ for (i = 0; i < s->nr_files; i++) {
+ s->fds[i] = s->files[i].real_fd;
+ s->files[i].fixed_fd = i;
+ }
+ reg.fds = s->fds;
+ reg.nr_fds = s->nr_files;
+
+ return syscall(__NR_sys_io_uring_register, s->ring_fd,
+ IORING_REGISTER_FILES, ®);
+}