diff -urN linux-2.4.17-rc2-virgin/fs/inode.c linux-2.4.17-rc2-wli2/fs/inode.c --- linux-2.4.17-rc2-virgin/fs/inode.c Tue Dec 18 23:18:03 2001 +++ linux-2.4.17-rc2-wli2/fs/inode.c Thu Dec 20 17:28:53 2001 @@ -916,14 +916,30 @@ return inode; } +/* + * The properties have changed from Lever's paper. This is + * the multiplicative page cache hash function from Chuck Lever's paper, + * adapted to the inode hash table. + * http://www.citi.umich.edu/techreports/reports/citi-tr-00-1.pdf + * iput() appears to be showing up in profiles, So I put what appears to + * be a theoretically sounder hash function here. + * + * Heavy testing by Anton Blanchard and Rusty Russell has verified that + * this inode cache hash function distributes keys well under heavy stress. + * + * Anton, Rusty, please insert a comment here describing the nature of the + * results of the testing. + * + * -- wli + */ static inline unsigned long hash(struct super_block *sb, unsigned long i_ino) { - unsigned long tmp = i_ino + ((unsigned long) sb / L1_CACHE_BYTES); - tmp = tmp + (tmp >> I_HASHBITS); - return tmp & I_HASHMASK; -} + unsigned long hashval = i_ino + (unsigned long) sb; + + hashval = (hashval * 2654435761UL) >> (BITS_PER_LONG - I_HASHBITS); -/* Yeah, I know about quadratic hash. Maybe, later. */ + return hashval & I_HASHMASK; +} /** * iunique - get a unique inode number