How to understand the codes about dentry ?
hi all the codes about filesystem in the kernel is: static inline struct list_head * d_hash(struct dentry *parent, unsigned long hash){ hash += (unsigned long)parent / L1_CACHE_BYTES; hash = hash^(hash>>D_HASHBITS)^(hash>>D_HASHBITS*2); return dentry_hashtable + (hash & D_HASHMASK);} I know the function parameter of hash belongs to the qstr string is looking up, and the local variableshash should add the *address of the dentry of parent*. Why count the hash value use "L1_CACHE_BYTES" , "D_HASHBITS" and "D_HASHMASK"? And How to understand the codes following ? hash += (unsigned long)parent / L1_CACHE_BYTES; hash = hash^(hash>>D_HASHBITS)^(hash>>D_HASHBITS*2);
Hi.. On Wed, Aug 28, 2013 at 9:30 PM, lx <lxlenovostar@gmail.com> wrote:
Why count the hash value use "L1_CACHE_BYTES" , "D_HASHBITS" and "D_HASHMASK"?
regarding L1_CACHE_BYTES, I have a strong guess, it is done to make the hash cache aligned...i.e faster read -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
participants (2)
-
lx -
Mulyadi Santosa