mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
vfs: make the string hashes salt the hash
We always mixed in the parent pointer into the dentry name hash, but we did it late at lookup time. It turns out that we can simplify that lookup-time action by salting the hash with the parent pointer early instead of late. A few other users of our string hashes also wanted to mix in their own pointers into the hash, and those are updated to use the same mechanism. Hash users that don't have any particular initial salt can just use the NULL pointer as a no-salt. Cc: Vegard Nossum <[email protected]> Cc: George Spelvin <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
147d9e7bca
commit
8387ff2577
38 changed files with 99 additions and 89 deletions
|
|
@ -413,7 +413,7 @@ void smk_insert_entry(struct smack_known *skp)
|
|||
unsigned int hash;
|
||||
struct hlist_head *head;
|
||||
|
||||
hash = full_name_hash(skp->smk_known, strlen(skp->smk_known));
|
||||
hash = full_name_hash(NULL, skp->smk_known, strlen(skp->smk_known));
|
||||
head = &smack_known_hash[hash & (SMACK_HASH_SLOTS - 1)];
|
||||
|
||||
hlist_add_head_rcu(&skp->smk_hashed, head);
|
||||
|
|
@ -433,7 +433,7 @@ struct smack_known *smk_find_entry(const char *string)
|
|||
struct hlist_head *head;
|
||||
struct smack_known *skp;
|
||||
|
||||
hash = full_name_hash(string, strlen(string));
|
||||
hash = full_name_hash(NULL, string, strlen(string));
|
||||
head = &smack_known_hash[hash & (SMACK_HASH_SLOTS - 1)];
|
||||
|
||||
hlist_for_each_entry_rcu(skp, head, smk_hashed)
|
||||
|
|
|
|||
Loading…
Reference in a new issue