mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
Merge branch 'salted-string-hash'
This changes the vfs dentry hashing to mix in the parent pointer at the _beginning_ of the hash, rather than at the end. That actually improves both the hash and the code generation, because we can move more of the computation to the "static" part of the dcache setup, and do less at lookup runtime. It turns out that a lot of other hash users also really wanted to mix in a base pointer as a 'salt' for the hash, and so the slightly extended interface ends up working well for other cases too. Users that want a string hash that is purely about the string pass in a 'salt' pointer of NULL. * merge branch 'salted-string-hash': fs/dcache.c: Save one 32-bit multiply in dcache lookup vfs: make the string hashes salt the hash
This commit is contained in:
commit
554828ee0d
39 changed files with 107 additions and 95 deletions
|
|
@ -174,7 +174,7 @@ struct iso9660_options{
|
|||
* Compute the hash for the isofs name corresponding to the dentry.
|
||||
*/
|
||||
static int
|
||||
isofs_hashi_common(struct qstr *qstr, int ms)
|
||||
isofs_hashi_common(const struct dentry *dentry, struct qstr *qstr, int ms)
|
||||
{
|
||||
const char *name;
|
||||
int len;
|
||||
|
|
@ -188,7 +188,7 @@ isofs_hashi_common(struct qstr *qstr, int ms)
|
|||
len--;
|
||||
}
|
||||
|
||||
hash = init_name_hash();
|
||||
hash = init_name_hash(dentry);
|
||||
while (len--) {
|
||||
c = tolower(*name++);
|
||||
hash = partial_name_hash(c, hash);
|
||||
|
|
@ -231,7 +231,7 @@ static int isofs_dentry_cmp_common(
|
|||
static int
|
||||
isofs_hashi(const struct dentry *dentry, struct qstr *qstr)
|
||||
{
|
||||
return isofs_hashi_common(qstr, 0);
|
||||
return isofs_hashi_common(dentry, qstr, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -246,7 +246,7 @@ isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry,
|
|||
* Compute the hash for the isofs name corresponding to the dentry.
|
||||
*/
|
||||
static int
|
||||
isofs_hash_common(struct qstr *qstr, int ms)
|
||||
isofs_hash_common(const struct dentry *dentry, struct qstr *qstr, int ms)
|
||||
{
|
||||
const char *name;
|
||||
int len;
|
||||
|
|
@ -258,7 +258,7 @@ isofs_hash_common(struct qstr *qstr, int ms)
|
|||
len--;
|
||||
}
|
||||
|
||||
qstr->hash = full_name_hash(name, len);
|
||||
qstr->hash = full_name_hash(dentry, name, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -266,13 +266,13 @@ isofs_hash_common(struct qstr *qstr, int ms)
|
|||
static int
|
||||
isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr)
|
||||
{
|
||||
return isofs_hash_common(qstr, 1);
|
||||
return isofs_hash_common(dentry, qstr, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
isofs_hashi_ms(const struct dentry *dentry, struct qstr *qstr)
|
||||
{
|
||||
return isofs_hashi_common(qstr, 1);
|
||||
return isofs_hashi_common(dentry, qstr, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Reference in a new issue