]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
nstring: use correct hash function !!!!
authorSage Weil <sage@newdream.net>
Tue, 11 Aug 2009 21:57:55 +0000 (14:57 -0700)
committerSage Weil <sage@newdream.net>
Tue, 11 Aug 2009 21:57:55 +0000 (14:57 -0700)
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.

src/include/nstring.h
src/include/object.h

index 01812dc1b6249ba7f2ca9680038e05b869fcde42..d18e79108d56e32dbe36c877f0fb9cc0c7c38e20 100644 (file)
@@ -41,8 +41,9 @@ namespace __gnu_cxx {
   {
     size_t operator()( const nstring& x ) const
     {
-      static hash<const char*> H;
-      return H(x.c_str());
+      //static hash<const char*> H;
+      //return H(x.c_str());
+      return ceph_full_name_hash(x.c_str(), x.length());
     }
   };
 }
index b072fa996200a3fba88a5105b431c7f5cf66e95a..1d397f9abc1fa94e0237a5698f9ae9d7ee86b073 100644 (file)
@@ -67,8 +67,9 @@ inline ostream& operator<<(ostream& out, const object_t& o) {
 namespace __gnu_cxx {
   template<> struct hash<object_t> {
     size_t operator()(const object_t& r) const { 
-      static hash<nstring> H;
-      return H(r.name);
+      //static hash<nstring> H;
+      //return H(r.name);
+      return ceph_full_name_hash(r.name.c_str(), r.name.length());
     }
   };
 }