]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: simplify finalizing scrub on replica
authorSage Weil <sage@newdream.net>
Fri, 21 Oct 2011 16:56:19 +0000 (09:56 -0700)
committerSage Weil <sage@newdream.net>
Fri, 21 Oct 2011 16:56:19 +0000 (09:56 -0700)
We can simply call osr.flush() (with pg lock held) to ensure that prior
writes are visible and scrubbable.  This avoids the funky handoff to
op_applied() (which didn't seem to work for me just now, although I didn't
fully debug.

In any case, this is much simpler.

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc

index 8cc9a7e4660ac15fe7d9f08dc707bf4e56ef0c59..2d8a0ba0e4def058f3e0715acd49953419d1d84d 100644 (file)
@@ -2788,15 +2788,11 @@ void PG::repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer
  * If msg->scrub_from is not set, replica_scrub calls build_scrubmap to
  * build a complete map (with the pg lock dropped).
  *
- * If msg->scrub_from is set, replica_scrub sets finalizing_scrub.
- * Similarly to scrub, if last_update_applied is behind info.last_update
- * replica_scrub returns to be requeued by sub_op_modify_applied.
- * replica_scrub then builds an incremental scrub map with the 
- * pg lock held.
+ * If msg->scrub_from is set, we build an incremental scrub map with
+ * the pg lock held.
  */
 void PG::replica_scrub(MOSDRepScrub *msg)
 {
-  assert(!active_rep_scrub);
   dout(7) << "replica_scrub" << dendl;
 
   if (msg->map_epoch < info.history.same_interval_since) {
@@ -2814,17 +2810,10 @@ void PG::replica_scrub(MOSDRepScrub *msg)
 
   ScrubMap map;
   if (msg->scrub_from > eversion_t()) {
-    if (finalizing_scrub) {
-      assert(last_update_applied == info.last_update);
-    } else {
-      finalizing_scrub = 1;
-      if (last_update_applied != info.last_update) {
-       active_rep_scrub = msg;
-       return;
-      }
-    }
+    // flush out in-flight writes to disk, so we can scrub the
+    // resulting on-disk state.
+    osr.flush();
     build_inc_scrub_map(map, msg->scrub_from);
-    finalizing_scrub = 0;
   } else {
     build_scrub_map(map);
   }
index 14a09f3c53cac929a9af072ddede881f559e627d..03937844c2c007f8a66cfa9db2b37e26ba92dc4b 100644 (file)
@@ -1505,7 +1505,6 @@ public:
   int scrub_waiting_on;
   epoch_t scrub_epoch_start;
   ScrubMap primary_scrubmap;
-  MOSDRepScrub *active_rep_scrub;
 
   void repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer, int ok_peer);
   bool _compare_scrub_objects(ScrubMap::object &auth,
@@ -1558,8 +1557,7 @@ public:
     finish_sync_event(NULL),
     finalizing_scrub(false),
     scrub_reserved(false), scrub_reserve_failed(false),
-    scrub_waiting_on(0),
-    active_rep_scrub(0)
+    scrub_waiting_on(0)
   {
     pool->get();
   }
index 17dadae58640b23a8ec40e84c9c0b422214097a4..35db0c1b4804e408dab25a62d1ff2527aedcb75b 100644 (file)
@@ -3438,12 +3438,6 @@ void ReplicatedPG::sub_op_modify_applied(RepModify *rm)
   bool done = rm->applied && rm->committed;
 
   last_update_applied = rm->op->version;
-  if (last_update_applied == info.last_update && finalizing_scrub) {
-    assert(active_rep_scrub);
-    osd->rep_scrub_wq.queue(active_rep_scrub);
-    active_rep_scrub->put();
-    active_rep_scrub = 0;
-  }
 
   unlock();
   if (done) {