From: Sage Weil Date: Thu, 16 Feb 2017 20:03:27 +0000 (-0500) Subject: messages/MOSDPGPull: make pulls vector private X-Git-Tag: v12.0.1~279^2~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b0faed78e7db172de4140fe9f450fe3095848367;p=ceph.git messages/MOSDPGPull: make pulls vector private Signed-off-by: Sage Weil --- diff --git a/src/messages/MOSDPGPull.h b/src/messages/MOSDPGPull.h index c274e06ef971..4a39b13875cb 100644 --- a/src/messages/MOSDPGPull.h +++ b/src/messages/MOSDPGPull.h @@ -21,12 +21,12 @@ class MOSDPGPull : public MOSDFastDispatchOp { static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; + vector pulls; public: pg_shard_t from; spg_t pgid; epoch_t map_epoch; - vector pulls; uint64_t cost; epoch_t get_map_epoch() const override { @@ -36,6 +36,13 @@ public: return pgid; } + void take_pulls(vector *outpulls) { + outpulls->swap(pulls); + } + void set_pulls(vector *inpulls) { + inpulls->swap(pulls); + } + MOSDPGPull() : MOSDFastDispatchOp(MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION), cost(0) @@ -82,9 +89,9 @@ public: void print(ostream& out) const { out << "MOSDPGPull(" << pgid - << " " << map_epoch - << " " << pulls; - out << ")"; + << " e" << map_epoch + << " cost " << cost + << ")"; } }; diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 12c62c15cc1b..f98e76fae4ac 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -927,7 +927,7 @@ void ReplicatedBackend::_do_pull_response(OpRequestRef op) reply->set_priority(m->get_priority()); reply->pgid = get_info().pgid; reply->map_epoch = m->map_epoch; - reply->pulls.swap(replies); + reply->set_pulls(&replies); reply->compute_cost(cct); t.register_on_complete( @@ -945,11 +945,11 @@ void ReplicatedBackend::do_pull(OpRequestRef op) pg_shard_t from = m->from; map > replies; - for (vector::iterator i = m->pulls.begin(); - i != m->pulls.end(); - ++i) { + vector pulls; + m->take_pulls(&pulls); + for (auto& i : pulls) { replies[from].push_back(PushOp()); - handle_pull(from, *i, &(replies[from].back())); + handle_pull(from, i, &(replies[from].back())); } send_pushes(m->get_priority(), replies); } @@ -1971,7 +1971,7 @@ void ReplicatedBackend::send_pulls(int prio, map > &p msg->set_priority(prio); msg->pgid = get_parent()->primary_spg_t(); msg->map_epoch = get_osdmap()->get_epoch(); - msg->pulls.swap(i->second); + msg->set_pulls(&i->second); msg->compute_cost(cct); get_parent()->send_message_osd_cluster(msg, con); }