feat(ecstore): runtime-probed io_uring read backend, gray-off by default (backlog#1104) (#4632)

feat(ecstore): add runtime-probed io_uring read backend, gray-off by default (rustfs/backlog#1104)

Wire the standalone rustfs-uring crate (https://github.com/rustfs/uring) into
LocalIoBackend as an opt-in read backend. When RUSTFS_IO_URING_READ_ENABLE is
set AND the per-disk io_uring probe succeeds, positioned reads go through the
cancel-safe UringDriver; otherwise — default, or on a restricted host, or on
any per-read driver error — reads fall back to StdBackend byte-for-byte, so the
default build is unchanged.

- Cargo.toml: rustfs-uring as a Linux-only git dependency (pinned rev). The
  guard scripts/check_no_tokio_io_uring.sh allows an explicit io-uring
  integration; only the tokio "io-uring" runtime feature is banned.
- UringBackend mirrors StdBackend::pread_bytes's resolution/access/bounds
  preamble and only swaps the raw byte read; the other three trait methods
  delegate to the inner StdBackend.
- Backend selection at LocalDisk construction via build_local_io_backend.
- Differential test uring_backend_reads_match_std: with the flag set, every
  positioned read returns byte-identical data (driver-served when io_uring is
  available, StdBackend fallback otherwise).

Verified: cargo check -p rustfs-ecstore on Linux; the differential test passes
under real io_uring (seccomp=unconfined). The runtime errno degradation latch,
per-disk probe cache, and productionization are tracked in
rustfs/backlog#1101/#1102.

Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
houseme
2026-07-10 00:57:17 +08:00
committed by GitHub
parent d90e354b11
commit da755eb66b
5 changed files with 287 additions and 1 deletions
Generated
+22
View File
@@ -5326,6 +5326,17 @@ dependencies = [
"rand_core 0.10.1",
]
[[package]]
name = "io-uring"
version = "0.7.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9080b15e63775b9a2ac7dca720f7050a8b955e092ea0f6020a4a80f69998cdc0"
dependencies = [
"bitflags 2.13.0",
"cfg-if",
"libc",
]
[[package]]
name = "ipconfig"
version = "0.3.4"
@@ -9169,6 +9180,7 @@ dependencies = [
"rustfs-signer",
"rustfs-storage-api",
"rustfs-tls-runtime",
"rustfs-uring",
"rustfs-utils",
"rustix 1.1.4",
"rustls",
@@ -10015,6 +10027,16 @@ dependencies = [
"tracing",
]
[[package]]
name = "rustfs-uring"
version = "0.1.0"
source = "git+https://github.com/rustfs/uring?rev=39018c09cde98b380658f1a1511349a3574daddf#39018c09cde98b380658f1a1511349a3574daddf"
dependencies = [
"io-uring",
"libc",
"tokio",
]
[[package]]
name = "rustfs-utils"
version = "1.0.0-beta.8"