for (list<OpRequestRef>::iterator i = waiting_for_map.begin();
i != waiting_for_map.end();
) {
- if (op_must_wait_for_map(get_osdmap_with_maplock(), *i)) {
+ if (op_must_wait_for_map(get_osdmap_with_maplock()->get_epoch(), *i)) {
break;
} else {
osd->op_wq.queue(make_pair(PGRef(this), *i));
waiting_for_map.push_back(op);
return;
}
- if (op_must_wait_for_map(get_osdmap_with_maplock(), op)) {
+ if (op_must_wait_for_map(get_osdmap_with_maplock()->get_epoch(), op)) {
waiting_for_map.push_back(op);
return;
}
return true;
}
-bool PG::op_must_wait_for_map(OSDMapRef curmap, OpRequestRef op)
+bool PG::op_must_wait_for_map(epoch_t cur_epoch, OpRequestRef& op)
{
switch (op->get_req()->get_type()) {
case CEPH_MSG_OSD_OP:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDOp*>(op->get_req())->get_map_epoch());
case MSG_OSD_SUBOP:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDSubOp*>(op->get_req())->map_epoch);
case MSG_OSD_SUBOPREPLY:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDSubOpReply*>(op->get_req())->map_epoch);
case MSG_OSD_PG_SCAN:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDPGScan*>(op->get_req())->map_epoch);
case MSG_OSD_PG_BACKFILL:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDPGBackfill*>(op->get_req())->map_epoch);
case MSG_OSD_PG_PUSH:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDPGPush*>(op->get_req())->map_epoch);
case MSG_OSD_PG_PULL:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDPGPull*>(op->get_req())->map_epoch);
case MSG_OSD_PG_PUSH_REPLY:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDPGPushReply*>(op->get_req())->map_epoch);
case MSG_OSD_EC_WRITE:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDECSubOpWrite*>(op->get_req())->map_epoch);
case MSG_OSD_EC_WRITE_REPLY:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDECSubOpWriteReply*>(op->get_req())->map_epoch);
case MSG_OSD_EC_READ:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDECSubOpRead*>(op->get_req())->map_epoch);
case MSG_OSD_EC_READ_REPLY:
return !have_same_or_newer_map(
- curmap,
+ cur_epoch,
static_cast<MOSDECSubOpReadReply*>(op->get_req())->map_epoch);
}
assert(0);
template<typename T, int MSGTYPE>
bool can_discard_replica_op(OpRequestRef& op);
- static bool op_must_wait_for_map(OSDMapRef curmap, OpRequestRef op);
+ static bool op_must_wait_for_map(epoch_t cur_epoch, OpRequestRef& op);
bool old_peering_msg(epoch_t reply_epoch, epoch_t query_epoch);
bool old_peering_evt(CephPeeringEvtRef evt) {
return old_peering_msg(evt->get_epoch_sent(), evt->get_epoch_requested());
}
- static bool have_same_or_newer_map(OSDMapRef osdmap, epoch_t e) {
- return e <= osdmap->get_epoch();
+ static bool have_same_or_newer_map(epoch_t cur_epoch, epoch_t e) {
+ return e <= cur_epoch;
}
bool have_same_or_newer_map(epoch_t e) {
return e <= get_osdmap()->get_epoch();