static const int HEAD_VERSION = 2;
static const int COMPAT_VERSION = 1;
+ vector<PullOp> pulls;
public:
pg_shard_t from;
spg_t pgid;
epoch_t map_epoch;
- vector<PullOp> pulls;
uint64_t cost;
epoch_t get_map_epoch() const override {
return pgid;
}
+ void take_pulls(vector<PullOp> *outpulls) {
+ outpulls->swap(pulls);
+ }
+ void set_pulls(vector<PullOp> *inpulls) {
+ inpulls->swap(pulls);
+ }
+
MOSDPGPull()
: MOSDFastDispatchOp(MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION),
cost(0)
void print(ostream& out) const {
out << "MOSDPGPull(" << pgid
- << " " << map_epoch
- << " " << pulls;
- out << ")";
+ << " e" << map_epoch
+ << " cost " << cost
+ << ")";
}
};
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(
pg_shard_t from = m->from;
map<pg_shard_t, vector<PushOp> > replies;
- for (vector<PullOp>::iterator i = m->pulls.begin();
- i != m->pulls.end();
- ++i) {
+ vector<PullOp> 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);
}
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);
}