From 74f5e5e9dc45358388513325a4634ef148cc4ccf Mon Sep 17 00:00:00 2001 From: Somnath Roy Date: Fri, 27 Jun 2014 14:05:53 -0700 Subject: [PATCH] PG::op_must_wait_for_map: pass the epoch rather than the map have_same_or_newer_map is also modified to accept epoch instead of map. Signed-off-by: Somnath Roy --- src/osd/PG.cc | 30 +++++++++++++++--------------- src/osd/PG.h | 6 +++--- src/osd/ReplicatedPG.cc | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a26c951ac145..173065e71d94 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1696,7 +1696,7 @@ void PG::take_op_map_waiters() for (list::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)); @@ -1713,7 +1713,7 @@ void PG::queue_op(OpRequestRef& op) 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; } @@ -4868,67 +4868,67 @@ bool PG::can_discard_request(OpRequestRef& op) 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(op->get_req())->get_map_epoch()); case MSG_OSD_SUBOP: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_SUBOPREPLY: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_SCAN: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_BACKFILL: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_PUSH: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_PULL: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_PUSH_REPLY: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_EC_WRITE: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_EC_WRITE_REPLY: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_EC_READ: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_EC_READ_REPLY: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); } assert(0); diff --git a/src/osd/PG.h b/src/osd/PG.h index 0481a35ab8d6..40a379f971d8 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2057,14 +2057,14 @@ public: template 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(); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 03e103a7f3a1..c45454446808 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1081,7 +1081,7 @@ void ReplicatedPG::do_request( osd->reply_op_error(op, -EPERM); return; } - assert(!op_must_wait_for_map(get_osdmap(), op)); + assert(!op_must_wait_for_map(get_osdmap()->get_epoch(), op)); if (can_discard_request(op)) { return; } -- 2.47.3