]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedBackend: reuse the already computed cost 9075/head
authorrunsisi <runsisi@zte.com.cn>
Wed, 11 May 2016 13:28:53 +0000 (21:28 +0800)
committerrunsisi <runsisi@zte.com.cn>
Fri, 13 May 2016 08:51:06 +0000 (16:51 +0800)
no need to compute the cost a second time

Signed-off-by: runsisi <runsisi@zte.com.cn>
src/messages/MOSDPGPush.h
src/osd/ReplicatedBackend.cc

index 83bb184999aa13ce265bf40bf66e6848f6cc0e69..1d1381b178990931f807d23534a539a4c3585591 100644 (file)
@@ -28,8 +28,11 @@ public:
   spg_t pgid;
   epoch_t map_epoch;
   vector<PushOp> pushes;
+
+private:
   uint64_t cost;
 
+public:
   void compute_cost(CephContext *cct) {
     cost = 0;
     for (vector<PushOp>::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)
index 1411126e8684b90a6fdcd9e875be3f829cffd849..13e8fb03571547bcbd828ece928b9a853d53128f 100644 (file)
@@ -1911,7 +1911,7 @@ void ReplicatedBackend::send_pushes(int prio, map<pg_shard_t, vector<PushOp> > &
        pushes += 1;
        msg->pushes.push_back(*j);
       }
-      msg->compute_cost(cct);
+      msg->set_cost(cost);
       get_parent()->send_message_osd_cluster(msg, con);
     }
   }