patch: portable dirhash

Ted Unangst tedu at zeitbombe.org
Wed Dec 17 10:09:29 PST 2003


while on the subject, there's a piece of code something like this in 
freebsd:
	/*
        * We hash the name and then some other bit of data that is
        * invariant over the dirhash's lifetime. Otherwise names
        * differing only in the last byte are placed close to one
        * another in the table, which is bad for linear probing.
        */
       hash = hash32_buf(name, namelen, HASHINIT);
       hash = hash32_buf(dh, sizeof(dh), hash);

which isn't doing what you'd expect (hashing the dh pointer), instead it 
hashes the first bytes of dh, conveniently a constant value so it works, 
but it provides no benefit.  fix is making it &dh.  i'd provide a diff, 
but it's a little large. :)


-- 
all we're waiting for is for something worth waiting for


More information about the freebsd-hackers mailing list