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: v14.0.1~1009^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0cdeb682af87a0703f8650e013e4685af0633f3f;p=ceph.git common/performance: improved hash calculation for hobject_t and ghobject_t Signed-off-by: Adam Kupczyk --- diff --git a/src/common/hobject.h b/src/common/hobject.h index 03abd4bd5517..c2d2c6b31863 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