diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index 7e76b3cdd6d..93b2412de53 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -921,6 +921,27 @@ void ObjectCacher::bh_write_adjacencies(BufferHead *bh, ceph::real_time cutoff, bh_write_scattered(blist); } +class ObjectCacher::C_WriteCommit : public Context { + ObjectCacher *oc; + int64_t poolid; + sobject_t oid; + vector > ranges; +public: + ceph_tid_t tid; + C_WriteCommit(ObjectCacher *c, int64_t _poolid, sobject_t o, loff_t s, + uint64_t l) : + oc(c), poolid(_poolid), oid(o), tid(0) { + ranges.push_back(make_pair(s, l)); + } + C_WriteCommit(ObjectCacher *c, int64_t _poolid, sobject_t o, + vector >& _ranges) : + oc(c), poolid(_poolid), oid(o), tid(0) { + ranges.swap(_ranges); + } + void finish(int r) { + oc->bh_write_commit(poolid, oid, ranges, tid, r); + } +}; void ObjectCacher::bh_write_scattered(list& blist) { assert(lock.is_locked()); @@ -1631,6 +1652,17 @@ int ObjectCacher::writex(OSDWrite *wr, ObjectSet *oset, Context *onfreespace) return r; } +class ObjectCacher::C_WaitForWrite : public Context { +public: + C_WaitForWrite(ObjectCacher *oc, uint64_t len, Context *onfinish) : + m_oc(oc), m_len(len), m_onfinish(onfinish) {} + void finish(int r); +private: + ObjectCacher *m_oc; + uint64_t m_len; + Context *m_onfinish; +}; + void ObjectCacher::C_WaitForWrite::finish(int r) { Mutex::Locker l(m_oc->lock); diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index b34a5de0139..4d2362cf4c3 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -592,38 +592,8 @@ class ObjectCacher { } }; - class C_WriteCommit : public Context { - ObjectCacher *oc; - int64_t poolid; - sobject_t oid; - vector > ranges; - public: - ceph_tid_t tid; - C_WriteCommit(ObjectCacher *c, int64_t _poolid, sobject_t o, loff_t s, - uint64_t l) : - oc(c), poolid(_poolid), oid(o), tid(0) { - ranges.push_back(make_pair(s, l)); - } - C_WriteCommit(ObjectCacher *c, int64_t _poolid, sobject_t o, - vector >& _ranges) : - oc(c), poolid(_poolid), oid(o), tid(0) { - ranges.swap(_ranges); - } - void finish(int r) { - oc->bh_write_commit(poolid, oid, ranges, tid, r); - } - }; - - class C_WaitForWrite : public Context { - public: - C_WaitForWrite(ObjectCacher *oc, uint64_t len, Context *onfinish) : - m_oc(oc), m_len(len), m_onfinish(onfinish) {} - void finish(int r); - private: - ObjectCacher *m_oc; - uint64_t m_len; - Context *m_onfinish; - }; + class C_WriteCommit; + class C_WaitForWrite; void perf_start(); void perf_stop();