----- Original Message -----=20
=46rom: "Aur=E9lien Charbon" <[email protected]>
To: <[email protected]>
Cc: "Neil Brown" <[email protected]>; "Iozone" <[email protected]>;=20
<[email protected]>; <[email protected]>
Sent: Friday, December 16, 2005 4:15 AM
Subject: Re: [NFS] Re: An interesting performance thing ?
Chuck Lever wrote:
> we might also think a little bit of the future (IPv6).
>
> IPv6 addresses are larger than IPv4 addresses, so they will need th=
eir own=20
> hash function, *or* we will have to design a reasonable hash functi=
on for=20
> variably-sized addresses now, which seems like a harder problem.
For information, in the IPv6 client support, we are currently using t=
he
hash_long function by doing a xor operation between the four 32 bit
parts or an IPv6 address.
static inline int ip_map_hash(struct ip_map *item)
{
return hash_str(item->m_class, IP_HASHBITS) ^
- hash_long((unsigned long)item->m_addr.s_addr, IP_HASHBITS);
+ hash_long((unsigned long)(item->m_addr.s6_addr32[0] ^
+ item->m_addr.s6_addr32[1] ^
+ item->m_addr.s6_addr32[2] ^
+ item->m_addr.s6_addr32[3]), IP_HASHBITS);
}
Regards,
Aur=E9lien
-------------
Aur=E9lien,
Perhaps in the future one might consider using Neil's new
hash for IP addresses ? Something like:
static inline int ip_map_hash(struct ip_map *item)
{
return hash_str(item->m_class, IP_HASHBITS) ^
- hash_long((unsigned long)item->m_addr.s_addr, IP_HASHBITS);
+ hash_ip((unsigned long)(item->m_addr.s6_addr32[0] ^
+ item->m_addr.s6_addr32[1] ^
+ item->m_addr.s6_addr32[2] ^
+ item->m_addr.s6_addr32[3]));
}
Enjoy,
Don Capps
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs