From 3494a2ac660823bd306949df6b9f706a9eae8d0e Mon Sep 17 00:00:00 2001 From: runsisi Date: Wed, 11 May 2016 21:28:53 +0800 Subject: [PATCH] osd/ReplicatedBackend: reuse the already computed cost no need to compute the cost a second time Signed-off-by: runsisi --- src/messages/MOSDPGPush.h | 7 +++++++ src/osd/ReplicatedBackend.cc | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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); } } -- 2.47.3