]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG::op_must_wait_for_map: pass the epoch rather than the map 2071/head
authorSomnath Roy <somnath.roy@sandisk.com>
Fri, 27 Jun 2014 21:05:53 +0000 (14:05 -0700)
committerSomnath Roy <somnath.roy@sandisk.com>
Thu, 10 Jul 2014 19:00:20 +0000 (12:00 -0700)
have_same_or_newer_map is also modified to accept epoch instead of
map.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc

index a26c951ac145bc771069f2d125a122f3083b3f11..173065e71d94d353b1eb728af4a1a1975e35f409 100644 (file)
@@ -1696,7 +1696,7 @@ void PG::take_op_map_waiters()
   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));
@@ -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<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);
index 0481a35ab8d69bc7af80f88b97bbaf2be8b728b0..40a379f971d8f6c12eb1849eb4a4d1cd8c3bb65a 100644 (file)
@@ -2057,14 +2057,14 @@ public:
   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();
index 03e103a7f3a19d868e755a8e2f512e2d080ab733..c45454446808cf750a4bbf9e46b50c2cd2f60c4e 100644 (file)
@@ -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;
   }