Merge branch 'salted-string-hash'
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Jul 2016 19:26:31 +0000 (12:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Jul 2016 19:26:31 +0000 (12:26 -0700)
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

1  2 
drivers/staging/lustre/lustre/llite/statahead.c
fs/autofs4/waitq.c
fs/cifs/dir.c
fs/dcache.c
fs/fuse/dir.c
fs/logfs/dir.c
fs/nfs/dir.c
net/core/dev.c

Simple merge
diff --cc fs/cifs/dir.c
Simple merge
diff --cc fs/dcache.c
Simple merge
diff --cc fs/fuse/dir.c
Simple merge
diff --cc fs/logfs/dir.c
@@@ -95,7 -95,7 +95,7 @@@ static int beyond_eof(struct inode *ino
   * of each character and pick a prime nearby, preferably a bit-sparse
   * one.
   */
--static u32 hash_32(const char *s, int len, u32 seed)
++static u32 logfs_hash_32(const char *s, int len, u32 seed)
  {
        u32 hash = seed;
        int i;
@@@ -159,7 -159,7 +159,7 @@@ static struct page *logfs_get_dd_page(s
        struct qstr *name = &dentry->d_name;
        struct page *page;
        struct logfs_disk_dentry *dd;
--      u32 hash = hash_32(name->name, name->len, 0);
++      u32 hash = logfs_hash_32(name->name, name->len, 0);
        pgoff_t index;
        int round;
  
@@@ -370,7 -370,7 +370,7 @@@ static int logfs_write_dir(struct inod
  {
        struct page *page;
        struct logfs_disk_dentry *dd;
--      u32 hash = hash_32(dentry->d_name.name, dentry->d_name.len, 0);
++      u32 hash = logfs_hash_32(dentry->d_name.name, dentry->d_name.len, 0);
        pgoff_t index;
        int round, err;
  
diff --cc fs/nfs/dir.c
Simple merge
diff --cc net/core/dev.c
Simple merge