|
|
Log in / Subscribe / Register

Dealing with negative dentries

Dealing with negative dentries

Posted May 21, 2022 8:57 UTC (Sat) by sammythesnake (guest, #17693)
In reply to: Dealing with negative dentries by willy
Parent article: Dealing with negative dentries

Perhaps the fix for this (and similar cases) could be to have an API that allows a file lookup with a set of locations, rather than a single file path.

E.g. a call to look for "ls" in any of ["/home/bob/bin","/usr/bin","/usr/sbin"] - there could then be a single dentry indicating that it's at "/usr/bin/ls", or none of the above for some other binary that isn't installed.

The same logic would work for include files or whatever, too...

Obvious downsides that occur to me:

1. You need to define a neat way to specify the $PATH equivalent in a way that could be canonically hashed as the key in the cache - that API would need careful design.

For positive entries, you could potentially only include path elements up to the one where the file was found, meaning the dentry created by the "ls" example above would also be hit if the $PATH was extended or even if the "sbin" element was omitted.

All of this would be much more complex and locating the correct negative dentries to invalidate when a file is created could be a faff. Given that this code is supposed to be faster than heading to the filesystem, there's a limit to how much cleverness is worth paying for.

2. You also might have lots of different $PATH / $INCLUDE specifications, leading to potentially lots of similar entries (especially the negative ones which wouldn't benefit from the path element pruning idea above) which would reduce the potential wins.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds