-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reformulate sparseWriter #21797
Reformulate sparseWriter #21797
Conversation
- Add more test cases - Test that we create the expected (large) holes; don't enforce anything for the <zerosThresholt ones. O)nly changes test code, should not change behavior. Signed-off-by: Miloslav Trmač <[email protected]>
... instead of using a multi-variable state machine. The net effect of this code is exactly the same as the previous implementation, except: - the operation after Write() returns an error might differ - If the file ends with zeroes, we don't Seek(-1), and we don't create a hole at all if it is too small, preferring to save a syscall. But this formulation is hopefully easier to prove correct. Signed-off-by: Miloslav Trmač <[email protected]>
Cockpit tests failed for commit 5d303ca. @martinpitt, @jelly, @mvollmer please check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe, mtrmac The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
1fc9d5a
into
containers:main
Instead of using a state machine, use a more straight-line code; also document and enforce various invariants.
The net effect of this code is exactly the same as the previous implementation, except:
Seek(-1)
, and we don't create a hole at all if it is too small, preferring to save a syscall.But this formulation is hopefully easier to prove correct.
Also adds more tests, to see behavior in more cases, and to actually test that this does create holes.
Alternatively, see https://github.com/mtrmac/libpod/tree/sparse for a commit series that ends with exactly the same code, but justifies every step individually.
But in this case I think it’s easier to just read the end product with its comments than to follow the 33 steps one by one.
Does this PR introduce a user-facing change?