]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: improve the ability to mock PointerWQ classes
authorJason Dillaman <dillaman@redhat.com>
Thu, 22 Jun 2017 17:31:10 +0000 (13:31 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 31 Aug 2017 14:00:32 +0000 (10:00 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 2d90bd8fdb30705d05569d242fc0cc4e36a2c7db)

Conflicts:
src/common/WorkQueue.h: trivial resolution
src/librbd/AioImageRequestWQ.cc: file renamed

src/common/WorkQueue.h
src/librbd/AioImageRequestWQ.cc

index bffe12b58fae0558a3ff59523f72ce4771710af8..cb6d111231a7ea421d87f8dc2238ef6936f3304a 100644 (file)
@@ -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<Context>(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) {
index f9942ce20596ac512d2dd0c4afd3169fcdec8c37..a81d49ee90da6cddead3848ef8014fd869c93a43 100644 (file)
@@ -66,7 +66,7 @@ AioImageRequestWQ<I>::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 <typename I>