diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-11-20 11:53:38 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-11-20 11:53:38 -0500 |
commit | 22de67c71daae75dde04416bb532a25cd4d19f3e (patch) | |
tree | 1a3e6170502a07d4878d1e1d13cedab04f6fcf60 | |
parent | 28c2b06a0477d2c84b7229d4e54056b1ec44ac36 (diff) | |
download | bfs-22de67c71daae75dde04416bb532a25cd4d19f3e.tar.xz |
ioq: Enable IORING_SETUP_SUBMIT_ALL
-rw-r--r-- | src/ioq.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -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, ¶ms); + +#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, ¶ms); + } +#endif + if (thread->ring_err) { return -1; } |