diff options
author | Sage Weil <sage@inktank.com> | 2013-01-18 15:27:24 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-01-18 15:44:41 -0800 |
commit | bc994045ad67fb70c7a0457b8cd29273dd5d1654 (patch) | |
tree | 2517eece48db8c120ae01a349a99312db4bad0a3 | |
parent | f6c69c3f1ac35546b90315fff625993ba5cd8c07 (diff) | |
download | ceph-bc994045ad67fb70c7a0457b8cd29273dd5d1654.tar.gz |
os: move apply_transactions() sync wrapper into ObjectStore
This has nothing to do with the backend implementation.
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/os/FileStore.cc | 22 | ||||
-rw-r--r-- | src/os/FileStore.h | 1 | ||||
-rw-r--r-- | src/os/ObjectStore.cc | 20 | ||||
-rw-r--r-- | src/os/ObjectStore.h | 3 |
4 files changed, 22 insertions, 24 deletions
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 4f13fe6e0db..4e208350902 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -2127,28 +2127,6 @@ int FileStore::do_transactions(list<Transaction*> &tls, uint64_t op_seq) return r; } -unsigned FileStore::apply_transactions(Sequencer *osr, - list<Transaction*> &tls, - Context *ondisk) -{ - // use op pool - Cond my_cond; - Mutex my_lock("FileStore::apply_transaction::my_lock"); - int r = 0; - bool done; - C_SafeCond *onreadable = new C_SafeCond(&my_lock, &my_cond, &done, &r); - - dout(10) << "apply queued" << dendl; - queue_transactions(osr, tls, onreadable, ondisk); - - my_lock.Lock(); - while (!done) - my_cond.Wait(my_lock); - my_lock.Unlock(); - dout(10) << "apply done r = " << r << dendl; - return r; -} - void FileStore::_set_replay_guard(coll_t cid, const SequencerPosition &spos, bool in_progress=false) diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 94b7c69b687..912810ebc09 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -307,7 +307,6 @@ public: int statfs(struct statfs *buf); int do_transactions(list<Transaction*> &tls, uint64_t op_seq); - unsigned apply_transactions(Sequencer *osr, list<Transaction*>& tls, Context *ondisk=0); unsigned _do_transaction(Transaction& t, uint64_t op_seq, int trans_num); diff --git a/src/os/ObjectStore.cc b/src/os/ObjectStore.cc index dacc5440308..6087dee50f7 100644 --- a/src/os/ObjectStore.cc +++ b/src/os/ObjectStore.cc @@ -20,6 +20,26 @@ ostream& operator<<(ostream& out, const ObjectStore::Sequencer& s) return out << "osr(" << s.get_name() << " " << &s << ")"; } +unsigned ObjectStore::apply_transactions(Sequencer *osr, + list<Transaction*> &tls, + Context *ondisk) +{ + // use op pool + Cond my_cond; + Mutex my_lock("ObjectStore::apply_transaction::my_lock"); + int r = 0; + bool done; + C_SafeCond *onreadable = new C_SafeCond(&my_lock, &my_cond, &done, &r); + + queue_transactions(osr, tls, onreadable, ondisk); + + my_lock.Lock(); + while (!done) + my_cond.Wait(my_lock); + my_lock.Unlock(); + return r; +} + void ObjectStore::Transaction::dump(ceph::Formatter *f) { f->open_array_section("ops"); diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 32e9360c5f0..5729490ac06 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -633,6 +633,7 @@ public: } }; + // synchronous wrappers unsigned apply_transaction(Transaction& t, Context *ondisk=0) { list<Transaction*> tls; tls.push_back(&t); @@ -646,7 +647,7 @@ public: unsigned apply_transactions(list<Transaction*>& tls, Context *ondisk=0) { return apply_transactions(NULL, tls, ondisk); } - virtual unsigned apply_transactions(Sequencer *osr, list<Transaction*>& tls, Context *ondisk=0) = 0; + unsigned apply_transactions(Sequencer *osr, list<Transaction*>& tls, Context *ondisk=0); virtual int queue_transaction(Sequencer *osr, Transaction* t) = 0; virtual int queue_transaction(Sequencer *osr, Transaction *t, Context *onreadable, Context *ondisk=0, |