4 ms·
> why is filesystem traversal not instantaneous Because a mounted file system isn't a simple indexed list of paths. File systems are shared, mutable state. T
by topspin 5y ago
> why is filesystem traversal not instantaneous
Because a mounted file system isn't a simple indexed list of paths. File systems are shared, mutable state.
The mechanism you're asking about is called the dentry cache[1] and a decent narrative of its operation is found here[2]. It has the fabulously complex job of atomically brokering the state of an arbitrary number of local and remote file systems between an arbitrary number of processes using arbitrary access patterns without consuming all available RAM. Expecting the dentry cache to yield 'instantaneous' results is unreasonable. Comparing its performance to that of an VCS index is naïve.
[1] https://www.kernel.org/doc/Documentation/filesystems/vfs.txt https://www.kernel.org/doc/Documentation/filesystems/vfs.txt
[2] https://www.halolinux.us/kernel-reference/the-dentry-cache.html https://www.halolinux.us/kernel-reference/the-dentry-cache.h... (no endorsement of these people, but the dentry cache description is both concise and sufficient.)