]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: add a Context *ondone to RepGathers
authorGreg Farnum <greg@inktank.com>
Fri, 4 Oct 2013 22:53:35 +0000 (15:53 -0700)
committerGreg Farnum <greg@inktank.com>
Fri, 25 Oct 2013 20:36:45 +0000 (13:36 -0700)
Make a few changes to make sure we trigger it when appropriate. We'll use
this shortly for object promotion, and perhaps for other things in future.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 1c880347814b97e8c413eb75f5ba1eadde826075..1952b860372c5e1ab7bd2f95a7f155323dd75b8a 100644 (file)
@@ -4711,14 +4711,14 @@ void ReplicatedPG::eval_repop(RepGather *repop)
   if (m)
     dout(10) << "eval_repop " << *repop
             << " wants=" << (m->wants_ack() ? "a":"") << (m->wants_ondisk() ? "d":"")
-            << (repop->done ? " DONE" : "")
+            << (repop->done() ? " DONE" : "")
             << dendl;
   else
     dout(10) << "eval_repop " << *repop << " (no op)"
-            << (repop->done ? " DONE" : "")
+            << (repop->done() ? " DONE" : "")
             << dendl;
 
-  if (repop->done)
+  if (repop->done())
     return;
 
   // apply?
@@ -4823,7 +4823,7 @@ void ReplicatedPG::eval_repop(RepGather *repop)
   // done.
   if (repop->waitfor_ack.empty() && repop->waitfor_disk.empty() &&
       repop->applied) {
-    repop->done = true;
+    repop->mark_done();
 
     calc_min_last_complete_ondisk();
 
index 4c92abd3b224ea2ad3adb514387f1a02f05436b7..9a39fd8f7a23c5946ce79790c1b8e571ba1825d7 100644 (file)
@@ -414,6 +414,7 @@ public:
    * State on the PG primary associated with the replicated mutation
    */
   class RepGather {
+    bool is_done;
   public:
     xlist<RepGather*>::item queue_item;
     int nref;
@@ -426,7 +427,7 @@ public:
 
     tid_t rep_tid;
 
-    bool applying, applied, aborted, done;
+    bool applying, applied, aborted;
 
     set<int>  waitfor_ack;
     //set<int>  waitfor_nvram;
@@ -435,6 +436,8 @@ public:
     //bool sent_nvram;
     bool sent_disk;
     
+    Context *ondone; ///< if set, this Context will be activated when repop is done
+
     utime_t   start;
     
     eversion_t          pg_local_last_complete;
@@ -444,14 +447,16 @@ public:
     
     RepGather(OpContext *c, ObjectContextRef pi, tid_t rt, 
              eversion_t lc) :
+      is_done(false),
       queue_item(this),
       nref(1),
       ctx(c), obc(pi),
       rep_tid(rt), 
-      applying(false), applied(false), aborted(false), done(false),
+      applying(false), applied(false), aborted(false),
       sent_ack(false),
       //sent_nvram(false),
       sent_disk(false),
+      ondone(NULL),
       pg_local_last_complete(lc),
       queue_snap_trimmer(false) { }
 
@@ -468,6 +473,14 @@ public:
        //generic_dout(0) << "deleting " << this << dendl;
       }
     }
+    void mark_done() {
+      is_done = true;
+      if (ondone)
+       ondone->complete(0);
+    }
+    bool done() {
+      return is_done;
+    }
   };