sync: allow target partition larger than source#406
Merged
deitch merged 1 commit intoJun 1, 2026
Conversation
verifyBlockCopy required both partitions' full ReadContents byte count to equal expectedSize, so copying a smaller source into a larger target failed even when the leading bytes matched. That larger-target shape is the normal one when growing a partition before a later swap-and-delete renames it into place. Require each side to hold at least expectedSize bytes, hash exactly expectedSize bytes per side via NewLimitWriter, and drop the equality check on the target's full size. A smaller-than-expected partition is still treated as an error. Closes diskfs#403. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
deitch
approved these changes
Jun 1, 2026
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.
Split out of #404 per review feedback.
verifyBlockCopyrequired both partitions' fullReadContentsbytecount to equal
expectedSize, so copying a smaller source into a largertarget failed even when the leading bytes matched — the normal shape
when growing a partition before a later swap-and-delete renames it into
place.
It now requires each side to hold at least
expectedSizebytes, hashesexactly
expectedSizebytes per side viaNewLimitWriter, and drops theequality check on the target's full size. A smaller-than-expected
partition is still an error.
Adds an internal regression test (
TestVerifyBlockCopyTargetLargerThanSource)that copies an 8 MiB source into a 24 MiB target and confirms both the
clean-grow and corrupted-target cases.
Closes #403.