Re: Word-at-a-time dcache name accesses (was Re: .. anybody know ofany filesystems that depend on the exact VFS 'namehash' implementation?)

From: Tetsuo Handa
Date: Sat Mar 03 2012 - 21:27:18 EST


A passer-by's mumble.

We are discussing about systems with huge "struct dentry" instances where
selecting a hash list based on "struct qstr"->hash cannot effectively narrow
down candidates to compare, aren't we?

Then, I thought we can reconstruct candidates in a hash list.

For example, sort "struct dentry" based on return value of
strcmp(dentry1->d_name.name, dentry2->d_name.name).

For another example, embed another hash value (calculated using some algorithm
that is different from the one used for "struct qstr"->hash) into the leading 1
or 2 or 4 bytes of "struct dentry"->d_name.name (e.g.

dentry1->d_name.name == { 0x12, 0x56, 0x34, 0x78, 'n', 'a', 'm', 'e', '1' }
dentry2->d_name.name == { 0xab, 0xcd, 0xef, 0x01, 'n', 'a', 'm', 'e', '2' }

for 32 bits hash case, where 0x12563478 is hash value for name1 and 0xabcdef01
is hash value for name2) and compare the embedded hash (e.g.

* (u32 *) dentry1->d_name.name == * (u32 *) dentry2->d_name.name

) before starting comparison of char array (e.g.

memcmp(dentry1->d_name.name + 4, dentry2->d_name.name + 4, len)

).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/