History

fs/namei.c: pull positivity check into follow_managed()

There are 4 callers; two proceed to check if result is positive and fail with ENOENT if it isn't; one (in handle_lookup_down()) is guaranteed to yield positive and one (in lookup_fast()) is _preceded_ by positivity check. However, follow_managed() on a negative dentry is a (fairly cheap) no-op on anything other than autofs. And negative autofs dentries are never hashed, so lookup_fast() is not going to run into one of those. Moreover, successful follow_managed() on a _positive_ dentry never yields a negative one (and we significantly rely upon that in callers of lookup_fast()). In other words, we can easily transpose the positivity check and the call of follow_managed() in lookup_fast(). And that allows to fold the positivity check *into* follow_managed(), simplifying life for the code downstream of its calls.

Al Viro committed 7 years ago

Commit d41efb51 parent 3e5aeec2 files · +16 −23Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/dcache.h+5−0
@@ -440,6 +440,11 @@ static inline bool d_is_negative(const struct dentry *dentry) · 439 unmodified lines
440 return d_is_miss(dentry);440 return d_is_miss(dentry);
441}441}
442 442
443static inline bool d_flags_negative(unsigned flags)
444{
445 return (flags & DCACHE_ENTRY_TYPE) == DCACHE_MISS_TYPE;
446}
447
443static inline bool d_is_positive(const struct dentry *dentry)448static inline bool d_is_positive(const struct dentry *dentry)
444{449{
445 return !d_is_negative(dentry);450 return !d_is_negative(dentry);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t