]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/hobject: use hash field for hash<>
authorSage Weil <sage@redhat.com>
Tue, 1 Nov 2016 18:05:51 +0000 (14:05 -0400)
committerSage Weil <sage@redhat.com>
Fri, 10 Feb 2017 22:59:50 +0000 (17:59 -0500)
No reason to waste CPU recalculating a hash value!

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/hobject.h

index c2d66424339317dfe3f968e968024bd7718b6b88..14a9ffc7c95d8dd8fba215bf5e34ced3d751c553 100644 (file)
@@ -337,9 +337,8 @@ WRITE_CLASS_ENCODER(hobject_t)
 namespace std {
   template<> struct hash<hobject_t> {
     size_t operator()(const hobject_t &r) const {
-      static hash<object_t> H;
       static rjhash<uint64_t> I;
-      return H(r.oid) ^ I(r.snap);
+      return r.get_hash() ^ I(r.snap);
     }
   };
 } // namespace std
@@ -564,9 +563,8 @@ WRITE_CLASS_ENCODER(ghobject_t)
 namespace std {
   template<> struct hash<ghobject_t> {
     size_t operator()(const ghobject_t &r) const {
-      static hash<object_t> H;
       static rjhash<uint64_t> I;
-      return H(r.hobj.oid) ^ I(r.hobj.snap);
+      return r.hobj.get_hash() ^ I(r.hobj.snap);
     }
   };
 } // namespace std