Expand description
io_uring batched small-file copy backend (Linux only).
This is the one place in ripsync-core where raw unsafe is justified: the
io_uring submission interface requires pointing the kernel at user buffers.
The rest of the crate keeps #![forbid(unsafe_code)]; here we opt in locally
and annotate every unsafe block with a // SAFETY: rationale.
Strategy: copy a chunk of files by (1) opening each source and temp file,
(2) submitting one read per file and reaping all completions, then
(3) submitting one write per file and reaping. Two ring round-trips replace
2·N read/write syscalls. Files larger than MAX_FILE but at most
MAX_LARGE_FILE are handled via linked [Splice] SQEs when the kernel
supports it (≥5.19). Anything larger or unsupported is reported back so the
caller can fall back to the portable path.
Structs§
- Job
- One copy request: read all of
src, write it to the fresh temp filetmp.
Constants§
- MAX_
FILE - Largest file handled by the single-shot uring path; bigger files fall back or use the splice path.
- MAX_
LARGE_ FILE - Largest file handled by the linked-splice uring path (64 MiB).
Functions§
- copy_
batch - Copy every job, returning a per-job result (bytes written, or the error that should trigger a portable-path fallback for that single file).
- copy_
single_ large - Copy a single large file via linked splice SQEs.
- kernel_
supports_ splice - Check whether the running kernel supports
IORING_OP_SPLICE(≥5.19). - large_
file_ stats - Return (attempts, successes) counters for large-file splice copies.