Skip to content

Accelerate sparse writes with SIMD-aware zero detection#1920

Merged
oferchen merged 1 commit into
masterfrom
optimize-oc-rsync-for-performance-and-structure
Nov 4, 2025
Merged

Accelerate sparse writes with SIMD-aware zero detection#1920
oferchen merged 1 commit into
masterfrom
optimize-oc-rsync-for-performance-and-structure

Conversation

@oferchen
Copy link
Copy Markdown
Owner

@oferchen oferchen commented Nov 4, 2025

Summary

  • accelerate the sparse chunk writer by delegating zero detection to memchr's SIMD fast paths
  • document the sparse writer CPU offload policy in internal docs
  • add the shared memchr dependency to the engine crate and lockfile

Testing

  • cargo check -p rsync-engine
  • cargo test -p rsync-engine --lib

https://chatgpt.com/codex/tasks/task_e_6909494455688323bae15b2a6ef747e8

@oferchen oferchen merged commit 9d69425 into master Nov 4, 2025
@oferchen oferchen deleted the optimize-oc-rsync-for-performance-and-structure branch November 4, 2025 00:38
oferchen added a commit that referenced this pull request May 6, 2026
* feat(fast_io): add io_uring RENAMEAT2 wrapper and kernel probe

Wraps `IORING_OP_RENAMEAT` (kernel 5.11+) with a OnceLock-cached
opcode probe and a borrowed-path argument struct mirroring the
shared-ring and splice probe conventions. Re-exports the libc
RENAME_NOREPLACE / RENAME_EXCHANGE / RENAME_WHITEOUT constants and
provides:

- `renameat2_supported()`: cached probe, short-circuits on
  `is_io_uring_available()`, then `IORING_REGISTER_PROBE` for opcode 35.
- `RenameAt2Args<'a>`: borrowed CStr paths + dirfds + flags.
- `build_renameat2_sqe()`: returns Unsupported when probe is false.
- `build_renameat2_sqe_unchecked()`: SQE wiring exercised by tests.
- `renameat2_blocking()`: synchronous submit + reap on a transient ring.

Mirrored stubs in `io_uring_stub.rs` keep the cross-platform surface
identical, with stub functions returning Unsupported. Linux-gated
integration test in `crates/fast_io/tests/io_uring_renameat2.rs`
exercises a real rename, RENAME_NOREPLACE rejection, and an exchange
swap, skipping when the kernel probe reports unsupported.

Closes #1920
Closes #1922

* fix(fast_io): use io::Error::other to satisfy clippy::io_other_error
oferchen added a commit that referenced this pull request May 13, 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.
oferchen added a commit that referenced this pull request May 18, 2026
* feat(fast_io): add io_uring RENAMEAT2 wrapper and kernel probe

Wraps `IORING_OP_RENAMEAT` (kernel 5.11+) with a OnceLock-cached
opcode probe and a borrowed-path argument struct mirroring the
shared-ring and splice probe conventions. Re-exports the libc
RENAME_NOREPLACE / RENAME_EXCHANGE / RENAME_WHITEOUT constants and
provides:

- `renameat2_supported()`: cached probe, short-circuits on
  `is_io_uring_available()`, then `IORING_REGISTER_PROBE` for opcode 35.
- `RenameAt2Args<'a>`: borrowed CStr paths + dirfds + flags.
- `build_renameat2_sqe()`: returns Unsupported when probe is false.
- `build_renameat2_sqe_unchecked()`: SQE wiring exercised by tests.
- `renameat2_blocking()`: synchronous submit + reap on a transient ring.

Mirrored stubs in `io_uring_stub.rs` keep the cross-platform surface
identical, with stub functions returning Unsupported. Linux-gated
integration test in `crates/fast_io/tests/io_uring_renameat2.rs`
exercises a real rename, RENAME_NOREPLACE rejection, and an exchange
swap, skipping when the kernel probe reports unsupported.

Closes #1920
Closes #1922

* fix(fast_io): use io::Error::other to satisfy clippy::io_other_error
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant