From: Linus Torvalds Date: Thu, 28 Jul 2016 19:26:31 +0000 (-0700) Subject: Merge branch 'salted-string-hash' X-Git-Tag: Ubuntu-4.10.0-19.21~2924 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=554828ee0db41618d101d9549db8808af9fd9d65;p=mirror_ubuntu-artful-kernel.git 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 --- 554828ee0db41618d101d9549db8808af9fd9d65 diff --cc fs/logfs/dir.c index 2d5336bd4efd,2d5336bd4efd..bcd754d216bd --- a/fs/logfs/dir.c +++ b/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;