From: Greg Farnum Date: Fri, 4 Oct 2013 22:53:35 +0000 (-0700) Subject: ReplicatedPG: add a Context *ondone to RepGathers X-Git-Tag: v0.72-rc1~13^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ade8f196500b6f39f0960c64be2b45e45d094148;p=ceph.git ReplicatedPG: add a Context *ondone to RepGathers 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 --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 1c880347814b..1952b860372c 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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(); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 4c92abd3b224..9a39fd8f7a23 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -414,6 +414,7 @@ public: * State on the PG primary associated with the replicated mutation */ class RepGather { + bool is_done; public: xlist::item queue_item; int nref; @@ -426,7 +427,7 @@ public: tid_t rep_tid; - bool applying, applied, aborted, done; + bool applying, applied, aborted; set waitfor_ack; //set 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; + } };