summaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-07-28 15:26:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-28 15:26:31 -0400
commit554828ee0db41618d101d9549db8808af9fd9d65 (patch)
tree8a3e3022c084f7c7c1eebc494a1b94f0ee0d5cae /fs/isofs
parent194dc870a5890e855ecffb30f3b80ba7c88f96d6 (diff)
parent703b5faf22fbddf984a361e6555f3a03fdba63d9 (diff)
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
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