diff options
author | Greg Farnum <greg@inktank.com> | 2013-10-04 15:53:35 -0700 |
---|---|---|
committer | Greg Farnum <greg@inktank.com> | 2013-10-08 16:24:05 -0700 |
commit | 38959b01d77f52c2dc2dcb962e5a0f952da428c9 (patch) | |
tree | 8cac597fdceafa7343fe9f562f05dd2d5dbfec01 | |
parent | 8bfef62bfa3e0844498532a2b997605ea1638f00 (diff) | |
download | ceph-38959b01d77f52c2dc2dcb962e5a0f952da428c9.tar.gz |
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 <greg@inktank.com>
-rw-r--r-- | src/osd/ReplicatedPG.cc | 8 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.h | 11 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a1dcddad2ec..f424aeaeee9 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4698,14 +4698,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? @@ -4808,7 +4808,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 b4259033eff..674f34cc4a6 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -405,6 +405,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; @@ -417,7 +418,7 @@ public: tid_t rep_tid; - bool applying, applied, aborted, done; + bool applying, applied, aborted; set<int> waitfor_ack; //set<int> waitfor_nvram; @@ -426,6 +427,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; @@ -435,14 +438,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) { } @@ -459,6 +464,8 @@ public: //generic_dout(0) << "deleting " << this << dendl; } } + void mark_done() { is_done = true; if (ondone) ondone->complete(0); } + bool done() { return is_done; } }; |