Skip to content

Conversation

@penberg
Copy link
Collaborator

@penberg penberg commented Feb 3, 2026

No description provided.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant