Skip to content

feat(fast_io): add splice/vmsplice zero-copy path for network-to-disk transfers#3993

Merged
oferchen merged 2 commits into
masterfrom
feat/splice-vmsplice-zero-copy-1361
May 13, 2026
Merged

feat(fast_io): add splice/vmsplice zero-copy path for network-to-disk transfers#3993
oferchen merged 2 commits into
masterfrom
feat/splice-vmsplice-zero-copy-1361

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

  • Add vmsplice(2) support for zero-copy userspace-buffer-to-file transfer via try_vmsplice_to_file(), complementing the existing splice(2) socket-to-file path
  • Make SplicePipe public with configurable pipe buffer size (default 1MB via fcntl(F_SETPIPE_SZ)) and add splice_to_file()/vmsplice_to_file() instance methods for pipe reuse across transfers
  • Add EINTR handling to all splice/vmsplice loops (previously missing - signals could cause spurious failures)
  • Refactor internal splice logic into splice_fd_to_file_via_pipe() and drain_pipe_to_fd() helpers shared by both the free functions and SplicePipe methods
  • Provide non-Linux stub implementations returning ErrorKind::Unsupported for cross-platform compilation
  • Replace benchmark placeholder with real splice_transfer and vmsplice_transfer benches alongside the read_write_baseline

Closes #1361.

Test plan

  • CI passes on Linux (splice/vmsplice tests exercise the real syscalls)
  • CI passes on macOS (non-Linux stub tests verify Unsupported errors for try_splice_to_file, try_vmsplice_to_file, SplicePipe::new())
  • CI passes on Windows (non-unix stub tests verify Unsupported for recv_fd_to_file)
  • Verify cargo bench -p fast_io --bench splice_pipe runs on Linux and reports throughput for all three strategies

@github-actions github-actions Bot added the enhancement New feature or request label May 13, 2026
@oferchen oferchen merged commit 9b189b7 into master May 13, 2026
39 checks passed
@oferchen oferchen deleted the feat/splice-vmsplice-zero-copy-1361 branch May 14, 2026 14:57
oferchen added a commit that referenced this pull request May 18, 2026
… transfers (#3993)

* feat(fast_io): add splice/vmsplice zero-copy path for network-to-disk transfers (#1361)

* fix: add type annotation for ambiguous numeric type in splice test
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