summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-11-20 11:53:38 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-11-20 11:53:38 -0500
commit22de67c71daae75dde04416bb532a25cd4d19f3e (patch)
tree1a3e6170502a07d4878d1e1d13cedab04f6fcf60
parent28c2b06a0477d2c84b7229d4e54056b1ec44ac36 (diff)
downloadbfs-22de67c71daae75dde04416bb532a25cd4d19f3e.tar.xz
ioq: Enable IORING_SETUP_SUBMIT_ALL
-rw-r--r--src/ioq.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/ioq.c b/src/ioq.c
index be5b758..02985da 100644
--- a/src/ioq.c
+++ b/src/ioq.c
@@ -836,16 +836,32 @@ static int ioq_ring_init(struct ioq *ioq, struct ioq_thread *thread) {
return -1;
}
- // Share io-wq workers between rings
struct io_uring_params params = {0};
+
+#ifdef IORING_SETUP_SUBMIT_ALL
+ // Don't abort submission just because an inline request fails
+ params.flags |= IORING_SETUP_SUBMIT_ALL;
+#endif
+
+ // Share io-wq workers between rings
if (prev) {
- params.flags |= IORING_SETUP_ATTACH_WQ;
+ params.flags = prev->ring.flags | IORING_SETUP_ATTACH_WQ;
params.wq_fd = prev->ring.ring_fd;
}
// Use a page for each SQE ring
size_t entries = 4096 / sizeof(struct io_uring_sqe);
thread->ring_err = -io_uring_queue_init_params(entries, &thread->ring, &params);
+
+#ifdef IORING_SETUP_SUBMIT_ALL
+ if (thread->ring_err == EINVAL && (params.flags & IORING_SETUP_SUBMIT_ALL)) {
+ // IORING_SETUP_SUBMIT_ALL is only supported since Linux 5.18,
+ // so try again without it
+ params.flags &= ~IORING_SETUP_SUBMIT_ALL;
+ thread->ring_err = -io_uring_queue_init_params(entries, &thread->ring, &params);
+ }
+#endif
+
if (thread->ring_err) {
return -1;
}