Skip to content

feat: wire io_uring RENAMEAT2 and LINKAT into production paths#3981

Merged
oferchen merged 1 commit into
masterfrom
feat/io-uring-renameat2-linkat-wiring
May 13, 2026
Merged

feat: wire io_uring RENAMEAT2 and LINKAT into production paths#3981
oferchen merged 1 commit into
masterfrom
feat/io-uring-renameat2-linkat-wiring

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

  • Wire IORING_OP_RENAMEAT (kernel 5.11+) into the temp-file commit path (DestinationWriteGuard::commit_named_temp_file), replacing synchronous rename(2) when io_uring is available
  • Wire IORING_OP_LINKAT (kernel 5.15+) into all hardlink creation paths (HardlinkApplyTracker::apply_follower, resolve_deferred, create_hard_link override, and --link-dest linking), replacing synchronous link(2) when io_uring is available
  • Add try_rename_via_io_uring() and try_hard_link_via_io_uring() convenience functions to fast_io that return Option<io::Result<()>> for transparent fallback
  • All paths fall back to std::fs::rename / std::fs::hard_link on non-Linux, older kernels, or when io_uring is disabled
  • Cross-platform: #[cfg]-gated implementations return None on non-Linux; no compilation impact on macOS/Windows

Closes #1924, closes #1925.

Test plan

  • Verify cargo fmt --all -- --check passes
  • Verify cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings passes
  • CI: nextest on Linux (stable) - exercises io_uring path on supported kernels
  • CI: macOS (stable) - exercises fallback path, no io_uring
  • CI: Windows (stable) - exercises fallback path, no io_uring
  • CI: Linux musl (stable) - exercises io_uring or fallback depending on kernel
  • New tests in fast_io: io_uring_rename_dispatch_tests, io_uring_hard_link_dispatch_tests
  • New tests in engine: io_uring_rename_dispatch (guard), io_uring_linkat_dispatch_tests (hard_links)

Wire the existing IORING_OP_RENAMEAT (task #1920) and IORING_OP_LINKAT
(task #1921) opcode wrappers into the temp-file commit and hardlink
finalization paths respectively.

On Linux 5.11+ with io_uring available, temp-file renames in
DestinationWriteGuard::commit_named_temp_file() now submit an
IORING_OP_RENAMEAT SQE instead of a synchronous rename(2) syscall.

On Linux 5.15+ with io_uring available, hardlink creation in
HardlinkApplyTracker, create_hard_link(), and the --link-dest path
now submit an IORING_OP_LINKAT SQE instead of a synchronous link(2).

Both paths fall back transparently to std::fs::rename / std::fs::hard_link
on non-Linux platforms, older kernels, or when io_uring is disabled.

Two new convenience functions in fast_io expose the try-or-fallback
pattern: try_rename_via_io_uring() and try_hard_link_via_io_uring(),
returning Option<io::Result<()>> so callers can fall through to the
portable implementation when None is returned.

Closes #1924, closes #1925.
@github-actions github-actions Bot added the enhancement New feature or request label May 13, 2026
@oferchen oferchen merged commit b74cb19 into master May 13, 2026
39 checks passed
@oferchen oferchen deleted the feat/io-uring-renameat2-linkat-wiring branch May 13, 2026 11:06
oferchen added a commit that referenced this pull request May 18, 2026
Wire the existing IORING_OP_RENAMEAT (task #1920) and IORING_OP_LINKAT
(task #1921) opcode wrappers into the temp-file commit and hardlink
finalization paths respectively.

On Linux 5.11+ with io_uring available, temp-file renames in
DestinationWriteGuard::commit_named_temp_file() now submit an
IORING_OP_RENAMEAT SQE instead of a synchronous rename(2) syscall.

On Linux 5.15+ with io_uring available, hardlink creation in
HardlinkApplyTracker, create_hard_link(), and the --link-dest path
now submit an IORING_OP_LINKAT SQE instead of a synchronous link(2).

Both paths fall back transparently to std::fs::rename / std::fs::hard_link
on non-Linux platforms, older kernels, or when io_uring is disabled.

Two new convenience functions in fast_io expose the try-or-fallback
pattern: try_rename_via_io_uring() and try_hard_link_via_io_uring(),
returning Option<io::Result<()>> so callers can fall through to the
portable implementation when None is returned.

Closes #1924, closes #1925.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant