aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-06-10 10:51:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-06-10 23:21:46 -0400
commit8387ff2577eb9ed245df9a39947f66976c6bcd02 (patch)
tree79fafcb5777f16e520d1c39e9389039f866b4c6d /fs/fat
parent147d9e7bcad3b8d5465f6eea6292731e7f35dee8 (diff)
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 <vegard.nossum@oracle.com> Cc: George Spelvin <linux@sciencehorizons.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat')
-rw-r--r--fs/fat/namei_msdos.c2
-rw-r--r--fs/fat/namei_vfat.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index b7e2b33aa793..1337c0c7527d 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -154,7 +154,7 @@ static int msdos_hash(const struct dentry *dentry, struct qstr *qstr)
154 154
155 error = msdos_format_name(qstr->name, qstr->len, msdos_name, options); 155 error = msdos_format_name(qstr->name, qstr->len, msdos_name, options);
156 if (!error) 156 if (!error)
157 qstr->hash = full_name_hash(msdos_name, MSDOS_NAME); 157 qstr->hash = full_name_hash(dentry, msdos_name, MSDOS_NAME);
158 return 0; 158 return 0;
159} 159}
160 160
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 7092584f424a..6ccdf3f34f90 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -107,7 +107,7 @@ static unsigned int vfat_striptail_len(const struct qstr *qstr)
107 */ 107 */
108static int vfat_hash(const struct dentry *dentry, struct qstr *qstr) 108static int vfat_hash(const struct dentry *dentry, struct qstr *qstr)
109{ 109{
110 qstr->hash = full_name_hash(qstr->name, vfat_striptail_len(qstr)); 110 qstr->hash = full_name_hash(dentry, qstr->name, vfat_striptail_len(qstr));
111 return 0; 111 return 0;
112} 112}
113 113
@@ -127,7 +127,7 @@ static int vfat_hashi(const struct dentry *dentry, struct qstr *qstr)
127 name = qstr->name; 127 name = qstr->name;
128 len = vfat_striptail_len(qstr); 128 len = vfat_striptail_len(qstr);
129 129
130 hash = init_name_hash(); 130 hash = init_name_hash(dentry);
131 while (len--) 131 while (len--)
132 hash = partial_name_hash(nls_tolower(t, *name++), hash); 132 hash = partial_name_hash(nls_tolower(t, *name++), hash);
133 qstr->hash = end_name_hash(hash); 133 qstr->hash = end_name_hash(hash);