From: runsisi Date: Wed, 11 May 2016 13:28:53 +0000 (+0800) Subject: osd/ReplicatedBackend: reuse the already computed cost X-Git-Tag: v11.0.0~544^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F9075%2Fhead;p=ceph.git osd/ReplicatedBackend: reuse the already computed cost no need to compute the cost a second time Signed-off-by: runsisi --- diff --git a/src/messages/MOSDPGPush.h b/src/messages/MOSDPGPush.h index 83bb184999a..1d1381b1789 100644 --- a/src/messages/MOSDPGPush.h +++ b/src/messages/MOSDPGPush.h @@ -28,8 +28,11 @@ public: spg_t pgid; epoch_t map_epoch; vector pushes; + +private: uint64_t cost; +public: void compute_cost(CephContext *cct) { cost = 0; for (vector::iterator i = pushes.begin(); @@ -43,6 +46,10 @@ public: return cost; } + void set_cost(uint64_t c) { + cost = c; + } + MOSDPGPush() : Message(MSG_OSD_PG_PUSH, HEAD_VERSION, COMPAT_VERSION), cost(0) diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 1411126e868..13e8fb03571 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -1911,7 +1911,7 @@ void ReplicatedBackend::send_pushes(int prio, map > & pushes += 1; msg->pushes.push_back(*j); } - msg->compute_cost(cct); + msg->set_cost(cost); get_parent()->send_message_osd_cluster(msg, con); } }