Feature: Sparse file handling (--sparse) #186
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Corresponding rsync flags/behavior:
--sparse— handle sparse files efficiently by skipping holesCurrent FastSync behavior:
to_disk()insrc/shared/file.c:411writes the entire file content sequentially withfwrite(). Sparse regions (long runs of zero bytes) are materialized as real disk blocks, wasting space and I/O.Proposed changes:
--sparsebool use_sparselseek(fd, hole_size, SEEK_CUR)orfseek()+ftruncate()to create holes instead of writing zerosSEEK_HOLE/SEEK_DATAon the source to preserve existing holes exactlyPriority: low
Rationale: Important for virtual machine images, databases, and other large sparse files. Without it, transfers can inflate disk usage dramatically.
Acceptance criteria:
client --sparse /src /dstproduces a sparse destination file when source has holes