fix: report logical bytes for zero-copy clonefile/FICLONE/ReFS paths#3394
Closed
fix: report logical bytes for zero-copy clonefile/FICLONE/ReFS paths#3394
Conversation
Zero-copy reflink methods (clonefile, FICLONE, ReFS DUPLICATE_EXTENTS) return bytes_copied=0 from the platform_copy dispatch layer because no data physically traversed userspace. The user-facing copy_file_optimized_with wrapper was passing this through unchanged, causing macOS test failures (test_copy_large_file, test_copy_file_optimized_result_type) and under-reporting transfer statistics. Substitute the source file size_hint when CopyResult::is_zero_copy() so progress and statistics reflect the data made available at the destination. The lower-layer dispatch contract is preserved (it still reports 0 for zero-copy methods, as required by platform_copy/tests.rs).
3 tasks
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
copy_file_optimized_withincrates/engine/src/local_copy/win_copy.rsto report the logical file size (viasize_hint) when the underlying platform copy used a zero-copy reflink method (clonefile/FICLONE/ReFSDUPLICATE_EXTENTS).test_copy_large_fileandtest_copy_file_optimized_result_typethat have been blocking master and several open PRs (feat: add AdaptiveLevelStrategy for runtime compression level tuning #3391, feat: add adaptive capacity scaling to ReorderBuffer #3392, docs: audit SIMD/scalar parity coverage across checksums crate #3393).platform_copystill returnsbytes_copied=0for zero-copy methods (verified bycrates/fast_io/src/platform_copy/tests.rs).Root cause
dispatch::platform_copy_implcorrectly returnsCopyResult { bytes_copied: 0, method: Clonefile }because no bytes physically traversed userspace. Thewin_copyuser-facing wrapper passed this through, soWinCopyResult::StandardCopy(0)was reported even when a multi-MB file was cloned.Fix
Use
CopyResult::is_zero_copy()(already exists for exactly this distinction) to substitute the sourcesize_hintfor the user-facing byte count when the operation went through a zero-copy path. Statistics and progress now reflect the data made available at the destination, matching upstream rsync's accounting.Test plan