Conversation
When creating files/directories in the overlay filesystem, we previously always called ensure_parent_dirs() to walk the entire path and verify each ancestor exists in the delta layer. This was expensive because it checked each path component against both delta and base layers. Now we skip this walk when the parent inode is already in the delta layer, since a directory can only be in delta if all its ancestors are too. This optimization eliminates the ensure_parent_dirs overhead for the common case of creating many files in the same directory.
When looking up a child in a directory that was created purely in delta (not copied from base), skip the base layer lookup entirely. Such directories can't have children in base, so the stat() syscall is wasted. This is detected by checking if the parent's delta inode has an origin mapping - if not, it was created in delta and never existed in base. Common case: npm creates node_modules/ in delta, then creates thousands of packages inside it. Previously each lookup would fall through to HostFS even though nothing could possibly exist there.
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.
No description provided.