summaryrefslogtreecommitdiffstats
path: root/fs/isofs
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/isofs
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/isofs')
-rw-r--r--fs/isofs/inode.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 131dedc920d8..761fade7680f 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -174,7 +174,7 @@ struct iso9660_options{
174 * Compute the hash for the isofs name corresponding to the dentry. 174 * Compute the hash for the isofs name corresponding to the dentry.
175 */ 175 */
176static int 176static int
177isofs_hashi_common(struct qstr *qstr, int ms) 177isofs_hashi_common(const struct dentry *dentry, struct qstr *qstr, int ms)
178{ 178{
179 const char *name; 179 const char *name;
180 int len; 180 int len;
@@ -188,7 +188,7 @@ isofs_hashi_common(struct qstr *qstr, int ms)
188 len--; 188 len--;
189 } 189 }
190 190
191 hash = init_name_hash(); 191 hash = init_name_hash(dentry);
192 while (len--) { 192 while (len--) {
193 c = tolower(*name++); 193 c = tolower(*name++);
194 hash = partial_name_hash(c, hash); 194 hash = partial_name_hash(c, hash);
@@ -231,7 +231,7 @@ static int isofs_dentry_cmp_common(
231static int 231static int
232isofs_hashi(const struct dentry *dentry, struct qstr *qstr) 232isofs_hashi(const struct dentry *dentry, struct qstr *qstr)
233{ 233{
234 return isofs_hashi_common(qstr, 0); 234 return isofs_hashi_common(dentry, qstr, 0);
235} 235}
236 236
237static int 237static int
@@ -246,7 +246,7 @@ isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry,
246 * Compute the hash for the isofs name corresponding to the dentry. 246 * Compute the hash for the isofs name corresponding to the dentry.
247 */ 247 */
248static int 248static int
249isofs_hash_common(struct qstr *qstr, int ms) 249isofs_hash_common(const struct dentry *dentry, struct qstr *qstr, int ms)
250{ 250{
251 const char *name; 251 const char *name;
252 int len; 252 int len;
@@ -258,7 +258,7 @@ isofs_hash_common(struct qstr *qstr, int ms)
258 len--; 258 len--;
259 } 259 }
260 260
261 qstr->hash = full_name_hash(name, len); 261 qstr->hash = full_name_hash(dentry, name, len);
262 262
263 return 0; 263 return 0;
264} 264}
@@ -266,13 +266,13 @@ isofs_hash_common(struct qstr *qstr, int ms)
266static int 266static int
267isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr) 267isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr)
268{ 268{
269 return isofs_hash_common(qstr, 1); 269 return isofs_hash_common(dentry, qstr, 1);
270} 270}
271 271
272static int 272static int
273isofs_hashi_ms(const struct dentry *dentry, struct qstr *qstr) 273isofs_hashi_ms(const struct dentry *dentry, struct qstr *qstr)
274{ 274{
275 return isofs_hashi_common(qstr, 1); 275 return isofs_hashi_common(dentry, qstr, 1);
276} 276}
277 277
278static int 278static int