fs: allow pre/background-fetch to be called before layer verification #467
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.
Fixes #461
Currently, pre/background fetch cannot be called before layer verification so are not started simultaneously. This is because each of them needs to be invoked after the layer verification (
*VerifiableReader.SkipVerify()
or*VerifiableReader.VerifyTOC()
) to make sure the fetched contents are expected. However, this behaviour slows down prefetch start in some cases.This commit fixes this issue by allowing pre/background fetch to called before the layer verification. Any verification error before the layer verification is recorded and reported when the verification is performed.
The filesystem calls pre/background fetch immediately after the resolving completes. If the verification is required and an error is reported, it doesn't use that layer and discards it.
This starts the prefetch of the last layer in an image (ghcr.io/stargz-containers/drupal:8.7.6-esgz) 2x faster.
PR
main