From: Jason Dillaman Date: Thu, 22 Jun 2017 17:31:10 +0000 (-0400) Subject: common: improve the ability to mock PointerWQ classes X-Git-Tag: v10.2.10~36^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=75f0bb9e7bbdea0fa6d15d253139f0583be6abea;p=ceph.git common: improve the ability to mock PointerWQ classes Signed-off-by: Jason Dillaman (cherry picked from commit 2d90bd8fdb30705d05569d242fc0cc4e36a2c7db) Conflicts: src/common/WorkQueue.h: trivial resolution src/librbd/AioImageRequestWQ.cc: file renamed --- diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index bffe12b58fae..cb6d111231a7 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -373,6 +373,9 @@ public: PointerWQ(string n, time_t ti, time_t sti, ThreadPool* p) : WorkQueue_(n, ti, sti), m_pool(p), m_processing(0) { } + void register_work_queue() { + m_pool->add_work_queue(this); + } virtual void _clear() { assert(m_pool->_lock.is_locked()); m_items.clear(); @@ -576,7 +579,7 @@ public: ContextWQ(const string &name, time_t ti, ThreadPool *tp) : ThreadPool::PointerWQ(name, ti, 0, tp), m_lock("ContextWQ::m_lock") { - tp->add_work_queue(this); + this->register_work_queue(); } void queue(Context *ctx, int result = 0) { diff --git a/src/librbd/AioImageRequestWQ.cc b/src/librbd/AioImageRequestWQ.cc index f9942ce20596..a81d49ee90da 100644 --- a/src/librbd/AioImageRequestWQ.cc +++ b/src/librbd/AioImageRequestWQ.cc @@ -66,7 +66,7 @@ AioImageRequestWQ::AioImageRequestWQ(I *image_ctx, const string &name, m_lock(util::unique_lock_name("AioImageRequestWQ::m_lock", this)) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " " << ": ictx=" << image_ctx << dendl; - tp->add_work_queue(this); + this->register_work_queue(); } template