Conversation
Also, this method was the last remaining part of our `tar-rs` fork, so we can switch to the upstream version now.
timvisee
approved these changes
Jan 8, 2026
Member
timvisee
left a comment
There was a problem hiding this comment.
Simple and effective, brilliant!
I like that we can now use upstream tar-rs.
generall
pushed a commit
that referenced
this pull request
Feb 9, 2026
* Remove call to Archive::set_sync Also, this method was the last remaining part of our `tar-rs` fork, so we can switch to the upstream version now. * Do syncfs
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.
Problem
Restoring snapshot that contains a lot of small files takes a lot of time.
This happen because we set
tar::Archive::set_sync(from our tar-rs fork) that callsfsyncon every file in a sequence. Fsyncing each file individually is slow.Solution
Disable
set_syncand usesyncfsinstead.syncfssyncs the whole filesystem at once, not just a particular single file.A potential drawback is that background writes (outside of snapshot restore code) can slow
syncfsdown, but I think it's a worthy tradeoff.Also, since
set_syncwas the last thing from ourtar-rsfork, we can switch to the upstreamtar-rs.Alternatives & synthetic benchmarks
I've considered the
fsyncin sequence (baseline).sync_file_rangein sequence thenfsyncin sequence.sync_file_rangeacts as a hint for the kernel to schedule flushing. It is non-blocking.fsyncacts as a barrier until the scheduled flush is done.syncfson a single file.io_uring: callfsyncthroughio_uringpipeline.Results and code: https://gist.github.com/xzfc/b22591fa5a5a192a1574857b00d7cb8d#file-results-md