From: Or Ozeri Date: Wed, 30 Jun 2021 06:08:52 +0000 (+0300) Subject: common: optimize op_target_t and hobject_t constructors X-Git-Tag: v17.1.0~1376^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42283%2Fhead;p=ceph.git common: optimize op_target_t and hobject_t constructors Switch to passing on arguments by reference instead of copying them. Signed-off-by: Or Ozeri --- diff --git a/src/common/hobject.h b/src/common/hobject.h index b7d4895c33ed..2fe722661c61 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -130,8 +130,8 @@ public: return hobject_t_max(); } - hobject_t(object_t oid, const std::string& key, snapid_t snap, uint32_t hash, - int64_t pool, std::string nspace) + hobject_t(const object_t& oid, const std::string& key, snapid_t snap, + uint32_t hash, int64_t pool, const std::string& nspace) : oid(oid), snap(snap), hash(hash), max(false), pool(pool), nspace(nspace), key(oid.name == key ? std::string() : key) { @@ -139,7 +139,7 @@ public: } hobject_t(const sobject_t &soid, const std::string &key, uint32_t hash, - int64_t pool, std::string nspace) + int64_t pool, const std::string& nspace) : oid(soid.oid), snap(soid.snap), hash(hash), max(false), pool(pool), nspace(nspace), key(soid.oid.name == key ? std::string() : key) { diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index e4c7ab4b4b6a..b67f0c712993 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1793,7 +1793,7 @@ public: epoch_t last_force_resend = 0; - op_target_t(object_t oid, object_locator_t oloc, int flags) + op_target_t(const object_t& oid, const object_locator_t& oloc, int flags) : flags(flags), base_oid(oid), base_oloc(oloc)