vfs: move dentry name length comparison from dentry_cmp() into callers
All callers do want to check the dentry length, but some of them can check the length and the hash together, so doing it in dentry_cmp() can be counter-productive. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
94753db5ed
commit
ee983e8967
@ -192,9 +192,6 @@ static inline int dentry_string_cmp(const unsigned char *cs, const unsigned char
|
|||||||
|
|
||||||
static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *ct, unsigned tcount)
|
static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *ct, unsigned tcount)
|
||||||
{
|
{
|
||||||
if (dentry->d_name.len != tcount)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Be careful about RCU walk racing with rename:
|
* Be careful about RCU walk racing with rename:
|
||||||
* use ACCESS_ONCE to fetch the name pointer.
|
* use ACCESS_ONCE to fetch the name pointer.
|
||||||
@ -1464,6 +1461,8 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry,
|
|||||||
continue;
|
continue;
|
||||||
if (alias->d_parent != entry->d_parent)
|
if (alias->d_parent != entry->d_parent)
|
||||||
continue;
|
continue;
|
||||||
|
if (alias->d_name.len != len)
|
||||||
|
continue;
|
||||||
if (dentry_cmp(alias, name, len))
|
if (dentry_cmp(alias, name, len))
|
||||||
continue;
|
continue;
|
||||||
__dget(alias);
|
__dget(alias);
|
||||||
@ -1882,6 +1881,8 @@ struct dentry *__d_lookup_rcu(const struct dentry *parent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dentry->d_name.len != len)
|
||||||
|
continue;
|
||||||
if (!dentry_cmp(dentry, str, len))
|
if (!dentry_cmp(dentry, str, len))
|
||||||
return dentry;
|
return dentry;
|
||||||
}
|
}
|
||||||
@ -1984,6 +1985,8 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name)
|
|||||||
tlen, tname, name))
|
tlen, tname, name))
|
||||||
goto next;
|
goto next;
|
||||||
} else {
|
} else {
|
||||||
|
if (dentry->d_name.len != len)
|
||||||
|
goto next;
|
||||||
if (dentry_cmp(dentry, str, len))
|
if (dentry_cmp(dentry, str, len))
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user