From: Adam Kupczyk Date: Tue, 29 May 2018 10:43:33 +0000 (+0200) Subject: common/performance: improved hash calculation for hobject_t and ghobject_t X-Git-Tag: v13.2.1~111^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e6d60fcbc7f2b043464d732b0fc0af37078bc63e;p=ceph.git common/performance: improved hash calculation for hobject_t and ghobject_t Signed-off-by: Adam Kupczyk (cherry picked from commit 0cdeb682af87a0703f8650e013e4685af0633f3f) --- diff --git a/src/common/hobject.h b/src/common/hobject.h index 9b3f38f44946..09aefd16fded 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -300,8 +300,13 @@ WRITE_CLASS_ENCODER(hobject_t) namespace std { template<> struct hash { size_t operator()(const hobject_t &r) const { - static rjhash I; - return r.get_hash() ^ I(r.snap); + static std::hash H; + static rjhash RJ; + size_t hash; + hash = H(r.oid); + hash = RJ(hash ^ r.get_hash()); + hash = RJ(hash ^ r.snap); + return hash; } }; } // namespace std @@ -473,8 +478,12 @@ WRITE_CLASS_ENCODER(ghobject_t) namespace std { template<> struct hash { size_t operator()(const ghobject_t &r) const { - static rjhash I; - return r.hobj.get_hash() ^ I(r.hobj.snap); + static rjhash RJ; + static hash HO; + size_t hash = HO(r.hobj); + hash = RJ(hash ^ r.generation); + hash = hash ^ r.shard_id.id; + return hash; } }; } // namespace std