-
Notifications
You must be signed in to change notification settings - Fork 149
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
file_zbc: punch hole on zone reset #660
Comments
There's system command fallocate, with option --dig-holes it can detect zeroed blocks and punch the hole, but for the test image I had the previous non-zero data and as a result only 2G were removed from a 46G backing file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Zone reset is simply rewriting the write pointer to the beginning without touching the actual zone data. It would be nice and easy to implement a hole punch, file operation freeing the metadata and data of the requested range. That way a backing file can be shrunk to only live zones. It's a bit like thin provisioning, the file starts sparsely allocated (using just the targetcli commands). I've measured the time of the hole punch on a moderately fragmented file on btrfs, with zone size 256M, the fallocate() call takes like 0.1s, ie. 100ms which is IMO acceptable.
Code change goes like
Errors can be ignored, it's just best effort.
The text was updated successfully, but these errors were encountered: