How to understand the codes about dentry ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux