From: Sage Weil Date: Tue, 11 Aug 2009 21:57:55 +0000 (-0700) Subject: nstring: use correct hash function !!!! X-Git-Tag: v0.13~80 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a3a61bcb2cd884b2b1a92d617a27be8475fec618;p=ceph.git nstring: use correct hash function !!!! This needs to match up with the hash used by the kernel when hashing the object name for placement. Use the better hash for all strings, while we're at it. --- diff --git a/src/include/nstring.h b/src/include/nstring.h index 01812dc1b624..d18e79108d56 100644 --- a/src/include/nstring.h +++ b/src/include/nstring.h @@ -41,8 +41,9 @@ namespace __gnu_cxx { { size_t operator()( const nstring& x ) const { - static hash H; - return H(x.c_str()); + //static hash H; + //return H(x.c_str()); + return ceph_full_name_hash(x.c_str(), x.length()); } }; } diff --git a/src/include/object.h b/src/include/object.h index b072fa996200..1d397f9abc1f 100644 --- a/src/include/object.h +++ b/src/include/object.h @@ -67,8 +67,9 @@ inline ostream& operator<<(ostream& out, const object_t& o) { namespace __gnu_cxx { template<> struct hash { size_t operator()(const object_t& r) const { - static hash H; - return H(r.name); + //static hash H; + //return H(r.name); + return ceph_full_name_hash(r.name.c_str(), r.name.length()); } }; }