3 ms·
Directories are just another type of file. So, if you do this, and your filenames are n characters long, you'll end up needing to do n file accesses just to fi
by pmiller2 5y ago
Directories are just another type of file. So, if you do this, and your filenames are n characters long, you'll end up needing to do n file accesses just to find the file you're looking for. Unless the underlying file system does something to make that particular access pattern fast, well... it's going to be stupidly slow after a certain point.
- loeg 5y ago> Unless the underlying file system does something to make that particular access pattern fast I don't know exactly how Linux does it. Windows hands off whole paths to the filesystem, so this idea is possible there. In FreeBSD, there is a generic routine (lookup(9)) that goes component by component, so at each step the filesystem is only asked to resolve a single component to a vnode. I think a clever filesystem implementation (in FreeBSD) could look at the remaining path and kick off asynchronous prefetch... but I am not aware of anything doing this.
- eru 5y agoI've played around with fuse a bit. There are two modes you can implement for your filesystem: in the so-called 'high level' mode you get the whole path. In the 'low level' mode the filesystem asks you for one piece of the path at a time. The low level mode seemed faster in my tests, and I think it's also closer to how Linux kernel works internally?