]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: swapped ThreadPool/ContextWQ for AsioEngine
authorJason Dillaman <dillaman@redhat.com>
Thu, 11 Jun 2020 22:06:19 +0000 (18:06 -0400)
committerJason Dillaman <dillaman@redhat.com>
Sat, 13 Jun 2020 02:44:54 +0000 (22:44 -0400)
The majority of usage of ContextWQ has been switched to use the
ASIO ContextWQ adapter class. The journal, RWL cache, and image update
notifications remain the only remaining use of dedicated ThreadPools in
librbd.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
115 files changed:
src/librbd/AsyncObjectThrottle.cc
src/librbd/AsyncRequest.cc
src/librbd/DeepCopyRequest.cc
src/librbd/DeepCopyRequest.h
src/librbd/ExclusiveLock.cc
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/ImageState.cc
src/librbd/ImageWatcher.cc
src/librbd/Journal.cc
src/librbd/Journal.h
src/librbd/ManagedLock.cc
src/librbd/ManagedLock.h
src/librbd/MirroringWatcher.cc
src/librbd/MirroringWatcher.h
src/librbd/ObjectMap.cc
src/librbd/Operations.cc
src/librbd/TrashWatcher.cc
src/librbd/TrashWatcher.h
src/librbd/Watcher.cc
src/librbd/Watcher.h
src/librbd/api/Image.cc
src/librbd/api/Migration.cc
src/librbd/api/Mirror.cc
src/librbd/api/Mirror.h
src/librbd/api/Pool.cc
src/librbd/api/Trash.cc
src/librbd/cache/ObjectCacherObjectDispatch.cc
src/librbd/cache/ObjectCacherWriteback.cc
src/librbd/cache/ParentCacheObjectDispatch.cc
src/librbd/cache/ReplicatedWriteLog.cc
src/librbd/cache/WriteAroundObjectDispatch.cc
src/librbd/deep_copy/SnapshotCopyRequest.cc
src/librbd/deep_copy/SnapshotCopyRequest.h
src/librbd/exclusive_lock/ImageDispatch.cc
src/librbd/exclusive_lock/PostAcquireRequest.cc
src/librbd/exclusive_lock/PreAcquireRequest.cc
src/librbd/image/AttachParentRequest.cc
src/librbd/image/CloneRequest.cc
src/librbd/image/CloneRequest.h
src/librbd/image/CloseRequest.cc
src/librbd/image/CreateRequest.cc
src/librbd/image/CreateRequest.h
src/librbd/image/DetachChildRequest.cc
src/librbd/image/DetachParentRequest.cc
src/librbd/image/RefreshParentRequest.cc
src/librbd/image/RemoveRequest.cc
src/librbd/image/RemoveRequest.h
src/librbd/image/TypeTraits.h
src/librbd/image/ValidatePoolRequest.cc
src/librbd/image/ValidatePoolRequest.h
src/librbd/internal.cc
src/librbd/internal.h
src/librbd/io/AioCompletion.cc
src/librbd/io/AsyncOperation.cc
src/librbd/io/CopyupRequest.cc
src/librbd/io/ImageDispatch.cc
src/librbd/io/ImageDispatcher.cc
src/librbd/io/ImageRequest.cc
src/librbd/io/ObjectDispatch.cc
src/librbd/io/ObjectDispatcher.cc
src/librbd/io/ObjectRequest.cc
src/librbd/io/QosImageDispatch.cc
src/librbd/io/QueueImageDispatch.cc
src/librbd/io/SimpleSchedulerObjectDispatch.cc
src/librbd/io/WriteBlockImageDispatch.cc
src/librbd/journal/CreateRequest.cc
src/librbd/journal/DemoteRequest.cc
src/librbd/journal/ObjectDispatch.cc
src/librbd/journal/OpenRequest.cc
src/librbd/journal/PromoteRequest.cc
src/librbd/journal/RemoveRequest.cc
src/librbd/journal/Replay.cc
src/librbd/journal/StandardPolicy.cc
src/librbd/journal/TypeTraits.h
src/librbd/managed_lock/AcquireRequest.cc
src/librbd/managed_lock/AcquireRequest.h
src/librbd/managed_lock/BreakRequest.cc
src/librbd/managed_lock/BreakRequest.h
src/librbd/managed_lock/ReleaseRequest.cc
src/librbd/managed_lock/ReleaseRequest.h
src/librbd/mirror/DisableRequest.cc
src/librbd/mirror/EnableRequest.cc
src/librbd/mirror/EnableRequest.h
src/librbd/mirror/GetInfoRequest.cc
src/librbd/mirror/GetInfoRequest.h
src/librbd/mirror/snapshot/PromoteRequest.cc
src/librbd/mirror/snapshot/PromoteRequest.h
src/librbd/operation/DisableFeaturesRequest.cc
src/librbd/operation/EnableFeaturesRequest.cc
src/librbd/operation/Request.cc
src/librbd/trash/RemoveRequest.cc
src/librbd/trash/RemoveRequest.h
src/librbd/watcher/Notifier.cc
src/librbd/watcher/Notifier.h
src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
src/test/librbd/deep_copy/test_mock_MetadataCopyRequest.cc
src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc
src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
src/test/librbd/image/test_mock_CloneRequest.cc
src/test/librbd/image/test_mock_RemoveRequest.cc
src/test/librbd/journal/test_mock_OpenRequest.cc
src/test/librbd/journal/test_mock_PromoteRequest.cc
src/test/librbd/journal/test_mock_ResetRequest.cc
src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
src/test/librbd/operation/test_mock_DisableFeaturesRequest.cc
src/test/librbd/operation/test_mock_EnableFeaturesRequest.cc
src/test/librbd/test_mock_DeepCopyRequest.cc
src/test/librbd/test_mock_ExclusiveLock.cc
src/test/librbd/test_mock_Journal.cc
src/test/librbd/test_mock_ManagedLock.cc
src/test/librbd/test_mock_Watcher.cc
src/test/librbd/test_mock_fixture.h

index c62c845394047f79eb44c4dcdeabe14ca13e8066..6adba21666ebb4ff2f065e9b70f08cd2cf8d08d7 100644 (file)
@@ -2,10 +2,10 @@
 // vim: ts=8 sw=2 smarttab
 #include "librbd/AsyncObjectThrottle.h"
 #include "common/RWLock.h"
-#include "common/WorkQueue.h"
 #include "librbd/AsyncRequest.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 
 namespace librbd
 {
index 67ea116a1515532c3040bc9da2f12ecf5c2cb138..c189613d0b78bfd178331b1490d43b5dd970186e 100644 (file)
@@ -3,7 +3,7 @@
 #include "librbd/AsyncRequest.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
-#include "common/WorkQueue.h"
+#include "librbd/asio/ContextWQ.h"
 
 namespace librbd
 {
index 33f1b245befd29697fb1560f6cbfc43664b212a5..af26ef0c9d78ee9d218d908159fd24977097b3c9 100644 (file)
@@ -32,7 +32,8 @@ DeepCopyRequest<I>::DeepCopyRequest(I *src_image_ctx, I *dst_image_ctx,
                                     librados::snap_t dst_snap_id_start,
                                     bool flatten,
                                     const ObjectNumber &object_number,
-                                    ContextWQ *work_queue, SnapSeqs *snap_seqs,
+                                    asio::ContextWQ *work_queue,
+                                    SnapSeqs *snap_seqs,
                                     deep_copy::Handler *handler,
                                     Context *on_finish)
   : RefCountedObject(dst_image_ctx->cct), m_src_image_ctx(src_image_ctx),
index 201c86f700fe1c45cf61a435b0a8f7ccbbee27d9..c8bd022996fbf6a3e58c4e12e585df272b117694 100644 (file)
@@ -19,6 +19,7 @@ class Context;
 namespace librbd {
 
 class ImageCtx;
+namespace asio { struct ContextWQ; }
 
 namespace deep_copy {
 
@@ -38,7 +39,7 @@ public:
                                  librados::snap_t dst_snap_id_start,
                                  bool flatten,
                                  const deep_copy::ObjectNumber &object_number,
-                                 ContextWQ *work_queue,
+                                 asio::ContextWQ *work_queue,
                                  SnapSeqs *snap_seqs,
                                  deep_copy::Handler *handler,
                                  Context *on_finish) {
@@ -53,7 +54,7 @@ public:
                   librados::snap_t src_snap_id_end,
                   librados::snap_t dst_snap_id_start,
                   bool flatten, const deep_copy::ObjectNumber &object_number,
-                  ContextWQ *work_queue, SnapSeqs *snap_seqs,
+                  asio::ContextWQ *work_queue, SnapSeqs *snap_seqs,
                   deep_copy::Handler *handler, Context *on_finish);
   ~DeepCopyRequest();
 
@@ -97,7 +98,7 @@ private:
   librados::snap_t m_dst_snap_id_start;
   bool m_flatten;
   deep_copy::ObjectNumber m_object_number;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
   SnapSeqs *m_snap_seqs;
   deep_copy::Handler *m_handler;
   Context *m_on_finish;
index e3838538f4f21439d5b8aaddbdccbcf5377aa281..ebd3198c3d6e2d363088835328be6c7902cba102 100644 (file)
@@ -11,6 +11,7 @@
 #include "librbd/exclusive_lock/PreReleaseRequest.h"
 #include "librbd/io/ImageDispatcherInterface.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "common/ceph_mutex.h"
 #include "common/dout.h"
 
index 07e96a053c90f87e585d1584a7957006025098a2..c5746f66eff8054864a15f225321db0483aed46e 100644 (file)
@@ -8,7 +8,6 @@
 #include "common/dout.h"
 #include "common/errno.h"
 #include "common/perf_counters.h"
-#include "common/WorkQueue.h"
 #include "common/Timer.h"
 
 #include "librbd/AsioEngine.h"
@@ -25,6 +24,7 @@
 #include "librbd/PluginRegistry.h"
 #include "librbd/Types.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/exclusive_lock/AutomaticPolicy.h"
 #include "librbd/exclusive_lock/StandardPolicy.h"
 #include "librbd/io/AioCompletion.h"
@@ -57,26 +57,6 @@ namespace librbd {
 
 namespace {
 
-class ThreadPoolSingleton : public ThreadPool {
-public:
-  ContextWQ *op_work_queue;
-
-  explicit ThreadPoolSingleton(CephContext *cct)
-    : ThreadPool(cct, "librbd::thread_pool", "tp_librbd", 1,
-                 "rbd_op_threads"),
-      op_work_queue(new ContextWQ("librbd::op_work_queue",
-                                  cct->_conf.get_val<uint64_t>("rbd_op_thread_timeout"),
-                                  this)) {
-    start();
-  }
-  ~ThreadPoolSingleton() override {
-    op_work_queue->drain();
-    delete op_work_queue;
-
-    stop();
-  }
-};
-
 class SafeTimerSingleton : public SafeTimer {
 public:
   ceph::mutex lock = ceph::make_mutex("librbd::SafeTimerSingleton::lock");
@@ -96,15 +76,6 @@ boost::asio::io_context& get_asio_engine_io_context(CephContext* cct) {
   return asio_engine_singleton->get_io_context();
 }
 
-void get_thread_pool_instance(CephContext *cct, ThreadPool **thread_pool,
-                              ContextWQ **op_work_queue) {
-  auto thread_pool_singleton =
-    &cct->lookup_or_create_singleton_object<ThreadPoolSingleton>(
-      "librbd::thread_pool", false, cct);
-  *thread_pool = thread_pool_singleton;
-  *op_work_queue = thread_pool_singleton->op_work_queue;
-}
-
 } // anonymous namespace
 
   const string ImageCtx::METADATA_CONF_PREFIX = "conf_";
@@ -154,8 +125,7 @@ void get_thread_pool_instance(CephContext *cct, ThreadPool **thread_pool,
     // FIPS zeroization audit 20191117: this memset is not security related.
     memset(&header, 0, sizeof(header));
 
-    ThreadPool *thread_pool;
-    get_thread_pool_instance(cct, &thread_pool, &op_work_queue);
+    get_work_queue(cct, &op_work_queue);
     io_image_dispatcher = new io::ImageDispatcher<ImageCtx>(this);
     io_object_dispatcher = new io::ObjectDispatcher<ImageCtx>(this);
 
@@ -935,10 +905,8 @@ void get_thread_pool_instance(CephContext *cct, ThreadPool **thread_pool,
   }
 
   void ImageCtx::get_work_queue(CephContext *cct,
-                                ContextWQ **op_work_queue) {
-
-    ThreadPool* thread_pool;
-    get_thread_pool_instance(cct, &thread_pool, op_work_queue);
+                                asio::ContextWQ **op_work_queue) {
+    *op_work_queue = get_asio_engine(cct)->get_work_queue();
   }
 
   void ImageCtx::get_timer_instance(CephContext *cct, SafeTimer **timer,
index 45b80423b93e4d834046d0d284c13a1d58b6faf1..b134117dc2c4b5e79e79be960ccece39a33ee6c6 100644 (file)
@@ -36,7 +36,6 @@
 #include <boost/lockfree/policies.hpp>
 #include <boost/lockfree/queue.hpp>
 
-class ContextWQ;
 class Finisher;
 class ThreadPool;
 class SafeTimer;
@@ -53,9 +52,8 @@ namespace librbd {
   template <typename> class Operations;
   template <typename> class PluginRegistry;
 
-  namespace cache {
-  template <typename> class ImageCache;
-  }
+  namespace asio { struct ContextWQ; }
+  namespace cache { template <typename> class ImageCache; }
   namespace exclusive_lock { struct Policy; }
   namespace io {
   class AioCompletion;
@@ -188,7 +186,7 @@ namespace librbd {
     io::ImageDispatcherInterface *io_image_dispatcher = nullptr;
     io::ObjectDispatcherInterface *io_object_dispatcher = nullptr;
 
-    ContextWQ *op_work_queue;
+    asio::ContextWQ *op_work_queue;
 
     PluginRegistry<ImageCtx>* plugin_registry;
 
@@ -347,7 +345,8 @@ namespace librbd {
     void set_journal_policy(journal::Policy *policy);
 
     static AsioEngine* get_asio_engine(CephContext* cct);
-    static void get_work_queue(CephContext *cct, ContextWQ **op_work_queue);
+    static void get_work_queue(CephContext *cct,
+                               asio::ContextWQ **op_work_queue);
     static void get_timer_instance(CephContext *cct, SafeTimer **timer,
                                    ceph::mutex **timer_lock);
   };
index d1d73e80b0be653c45aea81247f4aa1c053a0d69..4a9717e013d5de9abf4cac86d634c5cb8fae290f 100644 (file)
@@ -9,6 +9,7 @@
 #include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/image/CloseRequest.h"
 #include "librbd/image/OpenRequest.h"
 #include "librbd/image/RefreshRequest.h"
@@ -216,7 +217,7 @@ private:
     auto& thread_pool = m_cct->lookup_or_create_singleton_object<
       ThreadPoolSingleton>("librbd::ImageUpdateWatchers::thread_pool",
                           false, m_cct);
-    m_work_queue = new ContextWQ("librbd::ImageUpdateWatchers::op_work_queue",
+    m_work_queue = new ContextWQ("librbd::ImageUpdateWatchers::work_queue",
                                 m_cct->_conf.get_val<uint64_t>("rbd_op_thread_timeout"),
                                 &thread_pool);
   }
@@ -317,7 +318,7 @@ private:
   enum EventType {QUIESCE, UNQUIESCE};
 
   CephContext *m_cct;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
 
   ceph::mutex m_lock;
   std::map<uint64_t, QuiesceWatchCtx*> m_watchers;
index a2acaf9d6007456fa50dab527606a67ffce3d5c5..1a1f3f3809993d89419796b2e1553006234b3a2a 100644 (file)
 #include "librbd/TaskFinisher.h"
 #include "librbd/Types.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/exclusive_lock/Policy.h"
 #include "librbd/image_watcher/NotifyLockOwner.h"
 #include "librbd/io/AioCompletion.h"
 #include "include/encoding.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include <boost/bind.hpp>
 
 #define dout_subsys ceph_subsys_rbd
index 3910b18735750b817395a3ec9ee5b2e35650f8be..4c53012104573248ec4a774ef7d3a7001a69b253 100644 (file)
@@ -14,6 +14,7 @@
 #include "journal/Settings.h"
 #include "journal/Utils.h"
 #include "librbd/ImageCtx.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/ObjectDispatchSpec.h"
 #include "librbd/io/ObjectDispatcherInterface.h"
 #include "librbd/journal/CreateRequest.h"
@@ -41,15 +42,23 @@ using journal::util::C_DecodeTags;
 
 namespace {
 
-// TODO: once journaler is 100% async, remove separate threads and
-// reuse ImageCtx's thread pool
+// TODO: once journaler is 100% async and converted to ASIO, remove separate
+// threads and reuse librbd's AsioEngine
 class ThreadPoolSingleton : public ThreadPool {
 public:
+  ContextWQ *work_queue;
+
   explicit ThreadPoolSingleton(CephContext *cct)
-    : ThreadPool(cct, "librbd::Journal", "tp_librbd_journ", 1) {
+    : ThreadPool(cct, "librbd::Journal", "tp_librbd_journ", 1),
+      work_queue(new ContextWQ("librbd::journal::work_queue",
+                               cct->_conf.get_val<uint64_t>("rbd_op_thread_timeout"),
+                               this)) {
     start();
   }
   ~ThreadPoolSingleton() override {
+    work_queue->drain();
+    delete work_queue;
+
     stop();
   }
 };
@@ -59,7 +68,7 @@ struct C_IsTagOwner : public Context {
   librados::IoCtx &io_ctx;
   std::string image_id;
   bool *is_tag_owner;
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
   Context *on_finish;
 
   CephContext *cct = nullptr;
@@ -70,7 +79,8 @@ struct C_IsTagOwner : public Context {
   journal::TagData tag_data;
 
   C_IsTagOwner(librados::IoCtx &io_ctx, const std::string &image_id,
-               bool *is_tag_owner, ContextWQ *op_work_queue, Context *on_finish)
+               bool *is_tag_owner, asio::ContextWQ *op_work_queue,
+               Context *on_finish)
     : io_ctx(io_ctx), image_id(image_id), is_tag_owner(is_tag_owner),
       op_work_queue(op_work_queue), on_finish(on_finish),
       cct(reinterpret_cast<CephContext*>(io_ctx.cct())),
@@ -323,6 +333,24 @@ std::ostream &operator<<(std::ostream &os,
   return os;
 }
 
+
+template <typename I>
+void Journal<I>::MetadataListener::handle_update(::journal::JournalMetadata *) {
+  auto ctx = new LambdaContext([this](int r) {
+    journal->handle_metadata_updated();
+  });
+  journal->m_work_queue->queue(ctx, 0);
+}
+
+
+template <typename I>
+void Journal<I>::get_work_queue(CephContext *cct, ContextWQ **work_queue) {
+  auto thread_pool_singleton =
+    &cct->lookup_or_create_singleton_object<ThreadPoolSingleton>(
+      "librbd::journal::thread_pool", false, cct);
+  *work_queue = thread_pool_singleton->work_queue;
+}
+
 template <typename I>
 Journal<I>::Journal(I &image_ctx)
   : RefCountedObject(image_ctx.cct),
@@ -336,12 +364,7 @@ Journal<I>::Journal(I &image_ctx)
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << this << ": ictx=" << &m_image_ctx << dendl;
 
-  auto thread_pool_singleton =
-    &cct->lookup_or_create_singleton_object<ThreadPoolSingleton>(
-      "librbd::journal::thread_pool", false, cct);
-  m_work_queue = new ContextWQ("librbd::journal::work_queue",
-                               cct->_conf.get_val<uint64_t>("rbd_op_thread_timeout"),
-                               thread_pool_singleton);
+  get_work_queue(cct, &m_work_queue);
   ImageCtx::get_timer_instance(cct, &m_timer, &m_timer_lock);
 }
 
@@ -349,7 +372,6 @@ template <typename I>
 Journal<I>::~Journal() {
   if (m_work_queue != nullptr) {
     m_work_queue->drain();
-    delete m_work_queue;
   }
 
   std::lock_guard locker{m_lock};
@@ -373,14 +395,14 @@ int Journal<I>::create(librados::IoCtx &io_ctx, const std::string &image_id,
   CephContext *cct = reinterpret_cast<CephContext *>(io_ctx.cct());
   ldout(cct, 5) << __func__ << ": image=" << image_id << dendl;
 
-  ContextWQ *op_work_queue;
-  ImageCtx::get_work_queue(cct, &op_work_queue);
+  ContextWQ *work_queue;
+  get_work_queue(cct, &work_queue);
 
   C_SaferCond cond;
   journal::TagData tag_data(LOCAL_MIRROR_UUID);
   journal::CreateRequest<I> *req = journal::CreateRequest<I>::create(
     io_ctx, image_id, order, splay_width, object_pool, cls::journal::Tag::TAG_CLASS_NEW,
-    tag_data, IMAGE_CLIENT_ID, op_work_queue, &cond);
+    tag_data, IMAGE_CLIENT_ID, work_queue, &cond);
   req->send();
 
   return cond.wait();
@@ -391,12 +413,12 @@ int Journal<I>::remove(librados::IoCtx &io_ctx, const std::string &image_id) {
   CephContext *cct = reinterpret_cast<CephContext *>(io_ctx.cct());
   ldout(cct, 5) << __func__ << ": image=" << image_id << dendl;
 
-  ContextWQ *op_work_queue;
-  ImageCtx::get_work_queue(cct, &op_work_queue);
+  ContextWQ *work_queue;
+  get_work_queue(cct, &work_queue);
 
   C_SaferCond cond;
   journal::RemoveRequest<I> *req = journal::RemoveRequest<I>::create(
-    io_ctx, image_id, IMAGE_CLIENT_ID, op_work_queue, &cond);
+    io_ctx, image_id, IMAGE_CLIENT_ID, work_queue, &cond);
   req->send();
 
   return cond.wait();
@@ -407,13 +429,13 @@ int Journal<I>::reset(librados::IoCtx &io_ctx, const std::string &image_id) {
   CephContext *cct = reinterpret_cast<CephContext *>(io_ctx.cct());
   ldout(cct, 5) << __func__ << ": image=" << image_id << dendl;
 
-  ContextWQ *op_work_queue;
-  ImageCtx::get_work_queue(cct, &op_work_queue);
+  ContextWQ *work_queue;
+  get_work_queue(cct, &work_queue);
 
   C_SaferCond cond;
   auto req = journal::ResetRequest<I>::create(io_ctx, image_id, IMAGE_CLIENT_ID,
                                               Journal<>::LOCAL_MIRROR_UUID,
-                                              op_work_queue, &cond);
+                                              work_queue, &cond);
   req->send();
 
   return cond.wait();
@@ -428,7 +450,8 @@ void Journal<I>::is_tag_owner(I *image_ctx, bool *owner,
 
 template <typename I>
 void Journal<I>::is_tag_owner(librados::IoCtx& io_ctx, std::string& image_id,
-                              bool *is_tag_owner, ContextWQ *op_work_queue,
+                              bool *is_tag_owner,
+                              asio::ContextWQ *op_work_queue,
                               Context *on_finish) {
   CephContext *cct = reinterpret_cast<CephContext*>(io_ctx.cct());
   ldout(cct, 20) << __func__ << dendl;
@@ -443,7 +466,8 @@ void Journal<I>::is_tag_owner(librados::IoCtx& io_ctx, std::string& image_id,
 template <typename I>
 void Journal<I>::get_tag_owner(IoCtx& io_ctx, std::string& image_id,
                                std::string *mirror_uuid,
-                               ContextWQ *op_work_queue, Context *on_finish) {
+                               asio::ContextWQ *op_work_queue,
+                               Context *on_finish) {
   CephContext *cct = static_cast<CephContext *>(io_ctx.cct());
   ldout(cct, 20) << __func__ << dendl;
 
index 1554fed790568f97c6b459a46bd1317f79ed8b15..64ea13fe23ac9f8c811d38cad34c92156703c5c4 100644 (file)
 #include "common/AsyncOpTracker.h"
 #include "common/Cond.h"
 #include "common/RefCountedObj.h"
-#include "common/WorkQueue.h"
 #include "journal/Future.h"
 #include "journal/JournalMetadataListener.h"
 #include "journal/ReplayEntry.h"
 #include "journal/ReplayHandler.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/Types.h"
 #include "librbd/journal/TypeTraits.h"
 
 #include <atomic>
 #include <unordered_map>
 
+class ContextWQ;
 class SafeTimer;
-namespace journal {
-class Journaler;
-}
+namespace journal { class Journaler; }
 
 namespace librbd {
 
@@ -91,6 +90,8 @@ public:
   Journal(ImageCtxT &image_ctx);
   ~Journal();
 
+  static void get_work_queue(CephContext *cct, ContextWQ **work_queue);
+
   static bool is_journal_supported(ImageCtxT &image_ctx);
   static int create(librados::IoCtx &io_ctx, const std::string &image_id,
                     uint8_t order, uint8_t splay_width,
@@ -101,11 +102,11 @@ public:
   static void is_tag_owner(ImageCtxT *image_ctx, bool *is_tag_owner,
                            Context *on_finish);
   static void is_tag_owner(librados::IoCtx& io_ctx, std::string& image_id,
-                           bool *is_tag_owner, ContextWQ *op_work_queue,
+                           bool *is_tag_owner, asio::ContextWQ *op_work_queue,
                            Context *on_finish);
   static void get_tag_owner(librados::IoCtx& io_ctx, std::string& image_id,
                             std::string *mirror_uuid,
-                            ContextWQ *op_work_queue, Context *on_finish);
+                            asio::ContextWQ *op_work_queue, Context *on_finish);
   static int request_resync(ImageCtxT *image_ctx);
   static void promote(ImageCtxT *image_ctx, Context *on_finish);
   static void demote(ImageCtxT *image_ctx, Context *on_finish);
@@ -303,12 +304,7 @@ private:
 
     MetadataListener(Journal<ImageCtxT> *journal) : journal(journal) { }
 
-    void handle_update(::journal::JournalMetadata *) override {
-      auto ctx = new LambdaContext([this](int r) {
-        journal->handle_metadata_updated();
-      });
-      journal->m_work_queue->queue(ctx, 0);
-    }
+    void handle_update(::journal::JournalMetadata *) override;
   } m_metadata_listener;
 
   typedef std::set<journal::Listener *> Listeners;
index 1d3aa2d0581ba0e06228fb517da188d1f6b409ba..870139f761dc6cc65a26bc5c062636934db024f9 100644 (file)
@@ -2,6 +2,7 @@
 // vim: ts=8 sw=2 smarttab
 
 #include "librbd/ManagedLock.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/managed_lock/AcquireRequest.h"
 #include "librbd/managed_lock/BreakRequest.h"
 #include "librbd/managed_lock/GetLockerRequest.h"
@@ -15,7 +16,6 @@
 #include "common/dout.h"
 #include "common/errno.h"
 #include "common/Cond.h"
-#include "common/WorkQueue.h"
 #include "librbd/Utils.h"
 
 #define dout_subsys ceph_subsys_rbd
@@ -63,7 +63,7 @@ using managed_lock::util::decode_lock_cookie;
 using managed_lock::util::encode_lock_cookie;
 
 template <typename I>
-ManagedLock<I>::ManagedLock(librados::IoCtx &ioctx, ContextWQ *work_queue,
+ManagedLock<I>::ManagedLock(librados::IoCtx &ioctx, asio::ContextWQ *work_queue,
                             const string& oid, Watcher *watcher, Mode mode,
                             bool blacklist_on_break_lock,
                             uint32_t blacklist_expire_seconds)
index 3e03d00ed2da2c3abf2a63c06f8b2966ff5d35a2..9bf38ec30266a61b6bc8007e08a093fc20a7a69d 100644 (file)
 #include <string>
 #include <utility>
 
-class ContextWQ;
-
 namespace librbd {
 
 struct ImageCtx;
 
+namespace asio { struct ContextWQ; }
 namespace managed_lock { struct Locker; }
 
 template <typename ImageCtxT = librbd::ImageCtx>
@@ -30,7 +29,8 @@ private:
   typedef typename TypeTraits::Watcher Watcher;
 
 public:
-  static ManagedLock *create(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  static ManagedLock *create(librados::IoCtx& ioctx,
+                             asio::ContextWQ *work_queue,
                              const std::string& oid, Watcher *watcher,
                              managed_lock::Mode mode,
                              bool blacklist_on_break_lock,
@@ -42,7 +42,7 @@ public:
     delete this;
   }
 
-  ManagedLock(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  ManagedLock(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
               const std::string& oid, Watcher *watcher,
               managed_lock::Mode mode, bool blacklist_on_break_lock,
               uint32_t blacklist_expire_seconds);
@@ -211,7 +211,7 @@ private:
 
   librados::IoCtx& m_ioctx;
   CephContext *m_cct;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
   std::string m_oid;
   Watcher *m_watcher;
   managed_lock::Mode m_mode;
index f22dc149b6b9c318d044c1bca2b0f0e70560c159..c0cda5fa16a9f9d144db83d2049c435304ffe18f 100644 (file)
@@ -28,7 +28,7 @@ static const uint64_t NOTIFY_TIMEOUT_MS = 5000;
 
 template <typename I>
 MirroringWatcher<I>::MirroringWatcher(librados::IoCtx &io_ctx,
-                                      ContextWQ *work_queue)
+                                      asio::ContextWQ *work_queue)
   : Watcher(io_ctx, work_queue, RBD_MIRRORING) {
 }
 
index 4c72080b9ee7fb1b0066fedfadc836f7ea80e93b..e13762e9b3be151141aedd549f4a03eaf71a8815 100644 (file)
@@ -13,6 +13,7 @@
 
 namespace librbd {
 
+namespace asio { struct ContextWQ; }
 namespace watcher {
 namespace util {
 template <typename> struct HandlePayloadVisitor;
@@ -24,7 +25,7 @@ class MirroringWatcher : public Watcher {
   friend struct watcher::util::HandlePayloadVisitor<MirroringWatcher<ImageCtxT>>;
 
 public:
-  MirroringWatcher(librados::IoCtx &io_ctx, ContextWQ *work_queue);
+  MirroringWatcher(librados::IoCtx &io_ctx, asio::ContextWQ *work_queue);
 
   static int notify_mode_updated(librados::IoCtx &io_ctx,
                                  cls::rbd::MirrorMode mirror_mode);
index 0d60cc95f94e5790c012993c2e951a8b62c073f9..b0922c909f3db5d3d012740890be67d76884d44c 100644 (file)
@@ -5,6 +5,7 @@
 #include "librbd/BlockGuard.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ImageCtx.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/object_map/RefreshRequest.h"
 #include "librbd/object_map/ResizeRequest.h"
 #include "librbd/object_map/SnapshotCreateRequest.h"
@@ -15,7 +16,6 @@
 #include "librbd/Utils.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 
 #include "include/rados/librados.hpp"
 
index ee401bb61bed282fe44155ce339ba1be48f326db..f87c9debdf005094a1554a799ab620032149fe6b 100644 (file)
@@ -6,7 +6,6 @@
 #include "common/dout.h"
 #include "common/errno.h"
 #include "common/perf_counters.h"
-#include "common/WorkQueue.h"
 #include "osdc/Striper.h"
 
 #include "librbd/ExclusiveLock.h"
@@ -17,6 +16,7 @@
 #include "librbd/Types.h"
 #include "librbd/Utils.h"
 #include "librbd/api/Config.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/DisabledPolicy.h"
 #include "librbd/journal/StandardPolicy.h"
 #include "librbd/operation/DisableFeaturesRequest.h"
index 74e12e485a2778733d5b15a9742e6be386c2c65f..75d58820548584df7966f4006e494d8d78f5ecfc 100644 (file)
@@ -26,7 +26,8 @@ static const uint64_t NOTIFY_TIMEOUT_MS = 5000;
 } // anonymous namespace
 
 template <typename I>
-TrashWatcher<I>::TrashWatcher(librados::IoCtx &io_ctx, ContextWQ *work_queue)
+TrashWatcher<I>::TrashWatcher(librados::IoCtx &io_ctx,
+                              asio::ContextWQ *work_queue)
   : Watcher(io_ctx, work_queue, RBD_TRASH) {
 }
 
index 8f5fd1391c26187b53859c777a44b221ad61d197..684eaf4f52caab35a9dfc9f12911ae6572b540b1 100644 (file)
@@ -13,6 +13,7 @@
 
 namespace librbd {
 
+namespace asio { struct ContextWQ; }
 namespace watcher {
 namespace util {
 template <typename> struct HandlePayloadVisitor;
@@ -23,7 +24,7 @@ template <typename ImageCtxT = librbd::ImageCtx>
 class TrashWatcher : public Watcher {
   friend struct watcher::util::HandlePayloadVisitor<TrashWatcher<ImageCtxT>>;
 public:
-  TrashWatcher(librados::IoCtx &io_ctx, ContextWQ *work_queue);
+  TrashWatcher(librados::IoCtx &io_ctx, asio::ContextWQ *work_queue);
 
   static void notify_image_added(librados::IoCtx &io_ctx,
                                  const std::string& image_id,
index 3d9a85f1d27c893b73c878e2d8b7e835fd7c2ef9..89d90c6599bc6cb0b014b9f0694fd8988f0c221a 100644 (file)
@@ -5,9 +5,9 @@
 #include "librbd/watcher/RewatchRequest.h"
 #include "librbd/Utils.h"
 #include "librbd/TaskFinisher.h"
+#include "librbd/asio/ContextWQ.h"
 #include "include/encoding.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include <boost/bind.hpp>
 
 // re-include our assert to clobber the system one; fix dout:
@@ -87,11 +87,12 @@ void Watcher::C_NotifyAck::finish(int r) {
 #define dout_prefix *_dout << "librbd::Watcher: " << this << " " << __func__ \
                            << ": "
 
-Watcher::Watcher(librados::IoCtx& ioctx, ContextWQ *work_queue,
+Watcher::Watcher(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
                           const string& oid)
   : m_ioctx(ioctx), m_work_queue(work_queue), m_oid(oid),
     m_cct(reinterpret_cast<CephContext *>(ioctx.cct())),
-    m_watch_lock(ceph::make_shared_mutex(util::unique_lock_name("librbd::Watcher::m_watch_lock", this))),
+    m_watch_lock(ceph::make_shared_mutex(
+      util::unique_lock_name("librbd::Watcher::m_watch_lock", this))),
     m_watch_handle(0), m_notifier(work_queue, ioctx, oid),
     m_watch_state(WATCH_STATE_IDLE), m_watch_ctx(*this) {
 }
index e2889605010ca7fc9e19fdd6a7640560c1801acb..c3497ca88a91b5eef5169ed6930d120375a7a066 100644 (file)
 #include <string>
 #include <utility>
 
-class ContextWQ;
-
 namespace librbd {
 
+namespace asio { struct ContextWQ; }
 namespace watcher { struct NotifyResponse; }
 
 class Watcher {
@@ -32,7 +31,7 @@ public:
     void finish(int r) override;
   };
 
-  Watcher(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  Watcher(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
           const std::string& oid);
   virtual ~Watcher();
 
@@ -73,7 +72,7 @@ protected:
   };
 
   librados::IoCtx& m_ioctx;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
   std::string m_oid;
   CephContext *m_cct;
   mutable ceph::shared_mutex m_watch_lock;
index 977a4894eaa33dfd8573b25415675e75a1e0538e..d714aef3db522cc8113fb6ae2082ab77e83b17ab 100644 (file)
@@ -674,15 +674,15 @@ int Image<I>::deep_copy(I *src, I *dest, bool flatten,
     snap_id_end = src->snap_id;
   }
 
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
   ImageCtx::get_work_queue(cct, &op_work_queue);
 
   C_SaferCond cond;
   SnapSeqs snap_seqs;
   deep_copy::ProgressHandler progress_handler{&prog_ctx};
   auto req = DeepCopyRequest<I>::create(
-    src, dest, snap_id_start, snap_id_end, 0U, flatten, boost::none, op_work_queue,
-    &snap_seqs, &progress_handler, &cond);
+    src, dest, snap_id_start, snap_id_end, 0U, flatten, boost::none,
+    op_work_queue, &snap_seqs, &progress_handler, &cond);
   req->send();
   int r = cond.wait();
   if (r < 0) {
@@ -824,7 +824,7 @@ int Image<I>::remove(IoCtx& io_ctx, const std::string &image_name,
     // fall-through if trash isn't supported
   }
 
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
   ImageCtx::get_work_queue(cct, &op_work_queue);
 
   // might be a V1 image format that cannot be moved to the trash
index e097bad4a9278bb6f685a2a3a42f587608db61bc..3d9d86020f111c1a4b6e639883801b0bd099a859 100644 (file)
@@ -835,7 +835,7 @@ int Migration<I>::abort() {
 
     ceph_assert(dst_image_ctx->ignore_migrating);
 
-    ContextWQ *op_work_queue;
+    asio::ContextWQ *op_work_queue;
     ImageCtx::get_work_queue(m_cct, &op_work_queue);
     C_SaferCond on_remove;
     auto req = librbd::image::RemoveRequest<>::create(
@@ -1218,7 +1218,7 @@ int Migration<I>::create_dst_image() {
     }
   }
 
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
   ImageCtx::get_work_queue(m_cct, &op_work_queue);
 
   ConfigProxy config{m_cct->_conf};
@@ -1759,7 +1759,7 @@ int Migration<I>::remove_src_image() {
 
   ceph_assert(m_src_image_ctx->ignore_migrating);
 
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
   ImageCtx::get_work_queue(m_cct, &op_work_queue);
   C_SaferCond on_remove;
   auto req = librbd::image::RemoveRequest<I>::create(
index ec125d2c4994ce0a37924189519952405a97b739..3042b1e5e492bc6e57c89f91af42ddc36229d8c9 100644 (file)
@@ -813,7 +813,7 @@ int Mirror<I>::image_get_info(I *ictx, mirror_image_info_t *mirror_image_info) {
 
 template <typename I>
 void Mirror<I>::image_get_info(librados::IoCtx& io_ctx,
-                               ContextWQ *op_work_queue,
+                               asio::ContextWQ *op_work_queue,
                                const std::string &image_id,
                                mirror_image_info_t *mirror_image_info,
                                Context *on_finish) {
@@ -831,7 +831,7 @@ void Mirror<I>::image_get_info(librados::IoCtx& io_ctx,
 
 template <typename I>
 int Mirror<I>::image_get_info(librados::IoCtx& io_ctx,
-                              ContextWQ *op_work_queue,
+                              asio::ContextWQ *op_work_queue,
                               const std::string &image_id,
                               mirror_image_info_t *mirror_image_info) {
   C_SaferCond ctx;
@@ -1940,7 +1940,7 @@ int Mirror<I>::image_info_list(
       break;
     }
 
-    ContextWQ *op_work_queue;
+    asio::ContextWQ *op_work_queue;
     ImageCtx::get_work_queue(cct, &op_work_queue);
 
     for (auto &it : images) {
index b0dae99bc4a1e3e6e3ce94ac7d06b58ceb1c2498..8a4b4ab8dd9f509e3dd185f9ed70d2ae71160e6a 100644 (file)
@@ -9,13 +9,12 @@
 #include <string>
 #include <vector>
 
-class ContextWQ;
-
 struct Context;
 
 namespace librbd {
 
 struct ImageCtx;
+namespace asio { struct ContextWQ; }
 
 namespace api {
 
@@ -95,11 +94,11 @@ struct Mirror {
                              mirror_image_info_t *mirror_image_info,
                              Context *on_finish);
   static int image_get_info(librados::IoCtx& io_ctx,
-                            ContextWQ *op_work_queue,
+                            asio::ContextWQ *op_work_queue,
                             const std::string &image_id,
                             mirror_image_info_t *mirror_image_info);
   static void image_get_info(librados::IoCtx& io_ctx,
-                             ContextWQ *op_work_queue,
+                             asio::ContextWQ *op_work_queue,
                              const std::string &image_id,
                              mirror_image_info_t *mirror_image_info,
                              Context *on_finish);
index 9a2ef379ff97d7111f5164c0a669e5de8f48e630..75f2dd3b529338224ea97f991ca066da548f1a50 100644 (file)
@@ -251,7 +251,7 @@ int Pool<I>::init(librados::IoCtx& io_ctx, bool force) {
     return 0;
   }
 
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
   ImageCtx::get_work_queue(cct, &op_work_queue);
 
   C_SaferCond ctx;
index a5ba23306e923c3314c81ba5086572bbdd3f51ac..38a270fb8be01baa8928d18a00daca0d87734767 100644 (file)
@@ -90,7 +90,7 @@ int enable_mirroring(IoCtx &io_ctx, const std::string &image_id) {
 
   ldout(cct, 10) << dendl;
 
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
   ImageCtx::get_work_queue(cct, &op_work_queue);
   C_SaferCond ctx;
   auto req = mirror::EnableRequest<I>::create(
@@ -534,7 +534,7 @@ int Trash<I>::remove(IoCtx &io_ctx, const std::string &image_id, bool force,
     return -EBUSY;
   }
 
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
   ImageCtx::get_work_queue(cct, &op_work_queue);
 
   C_SaferCond cond;
index 9d304c54a05201809ede97051104fd18fc580df6..8479ef06b87f24c3b11a1856e5613cc01f4599fa 100644 (file)
@@ -3,10 +3,10 @@
 
 #include "librbd/cache/ObjectCacherObjectDispatch.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/cache/ObjectCacherWriteback.h"
 #include "librbd/io/ObjectDispatchSpec.h"
 #include "librbd/io/ObjectDispatcherInterface.h"
index 169b99a4ce0143ead209fc257c112caac6dbf10e..c05d9e737f6514fb77e6bafa2b4ad0a6d4ee1835 100644 (file)
@@ -7,7 +7,6 @@
 #include "common/ceph_context.h"
 #include "common/dout.h"
 #include "common/ceph_mutex.h"
-#include "common/WorkQueue.h"
 #include "osdc/Striper.h"
 #include "include/Context.h"
 #include "include/rados/librados.hpp"
@@ -19,6 +18,7 @@
 #include "librbd/ObjectMap.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/ObjectDispatchSpec.h"
 #include "librbd/io/ObjectDispatcherInterface.h"
index bf302acd3f785ee14b18720e32feaad255e17c60..088384b1525d78eaef6c1e41de946afcd1e82b77 100644 (file)
@@ -1,10 +1,9 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
-#include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/ObjectDispatchSpec.h"
 #include "librbd/io/ObjectDispatcherInterface.h"
 #include "librbd/io/Utils.h"
index a2c62bc43bdee2a3770cf14097b69bef51abc117..38309723054fc54102aedb57278c2a861c820c53 100644 (file)
@@ -14,6 +14,7 @@
 #include "common/Timer.h"
 #include "common/perf_counters.h"
 #include "librbd/ImageCtx.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/cache/rwl/ImageCacheState.h"
 #include "librbd/cache/rwl/LogEntry.h"
 #include "librbd/cache/rwl/Types.h"
index cdd8ea27160839608a8d3e7e11cea5f692210793..0d96d0296596daf2f3214ce1f224acabb0cde824 100644 (file)
@@ -4,9 +4,9 @@
 #include "librbd/cache/WriteAroundObjectDispatch.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/ObjectDispatchSpec.h"
 #include "librbd/io/ObjectDispatcherInterface.h"
 
index 8ac59308873f4ba1be3f72d24743a1d759d9b5a6..9ff02644de965c38df0a130507bba979c9b295f5 100644 (file)
@@ -5,11 +5,11 @@
 #include "SetHeadRequest.h"
 #include "SnapshotCreateRequest.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ObjectMap.h"
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "osdc/Striper.h"
 
 #define dout_subsys ceph_subsys_rbd
@@ -48,7 +48,8 @@ SnapshotCopyRequest<I>::SnapshotCopyRequest(I *src_image_ctx,
                                             librados::snap_t src_snap_id_start,
                                             librados::snap_t src_snap_id_end,
                                             librados::snap_t dst_snap_id_start,
-                                            bool flatten, ContextWQ *work_queue,
+                                            bool flatten,
+                                            asio::ContextWQ *work_queue,
                                             SnapSeqs *snap_seqs,
                                             Context *on_finish)
   : RefCountedObject(dst_image_ctx->cct), m_src_image_ctx(src_image_ctx),
index a80f981336ff87af88e8e3748437f9768722a7a7..9c6abdf7327aae3883526825c299e3319b711bcc 100644 (file)
@@ -18,6 +18,9 @@
 class Context;
 
 namespace librbd {
+
+namespace asio { struct ContextWQ; }
+
 namespace deep_copy {
 
 template <typename ImageCtxT = librbd::ImageCtx>
@@ -28,7 +31,7 @@ public:
                                      librados::snap_t src_snap_id_start,
                                      librados::snap_t src_snap_id_end,
                                      librados::snap_t dst_snap_id_start,
-                                     bool flatten, ContextWQ *work_queue,
+                                     bool flatten, asio::ContextWQ *work_queue,
                                      SnapSeqs *snap_seqs, Context *on_finish) {
     return new SnapshotCopyRequest(src_image_ctx, dst_image_ctx,
                                    src_snap_id_start, src_snap_id_end,
@@ -40,8 +43,8 @@ public:
                       librados::snap_t src_snap_id_start,
                       librados::snap_t src_snap_id_end,
                       librados::snap_t dst_snap_id_start,
-                      bool flatten, ContextWQ *work_queue, SnapSeqs *snap_seqs,
-                      Context *on_finish);
+                      bool flatten, asio::ContextWQ *work_queue,
+                      SnapSeqs *snap_seqs, Context *on_finish);
 
   void send();
   void cancel();
@@ -92,7 +95,7 @@ private:
   librados::snap_t m_src_snap_id_end;
   librados::snap_t m_dst_snap_id_start;
   bool m_flatten;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
   SnapSeqs *m_snap_seqs_result;
   SnapSeqs m_snap_seqs;
   Context *m_on_finish;
index 7b411149d32af19026cb200b120e6c5dc1bb77df..6f6cf231f808dc6d5074ae0770b63928684c5d21 100644 (file)
@@ -5,7 +5,6 @@
 #include "include/Context.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
index c194a46814a71ae9a1746129aa8b2dfd9e8851c2..7075090b55c4d7c179279d0b080a762412dc2349 100644 (file)
@@ -6,7 +6,6 @@
 #include "cls/lock/cls_lock_types.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "include/stringify.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ImageCtx.h"
index ba3da1a24bacc68a8b0c147aaba2a623718a0193..feb0913d7152fbe9f327f345dab6057a577fd263 100644 (file)
@@ -8,6 +8,7 @@
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageWatcher.h"
 #include "librbd/ImageState.h"
+#include "librbd/asio/ContextWQ.h"
 
 #define dout_subsys ceph_subsys_rbd
 #undef dout_prefix
index 116ef7ffada9ab367fafc663c1d3fdf20751dbd4..d0c35b6a91cb1cbcc760baeeee5ff9457b2ef135 100644 (file)
@@ -4,7 +4,6 @@
 #include "librbd/image/AttachParentRequest.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
index b1809b59bc70fea57a47c1238371fef2fe483943..8db5ee0efc7f3081a6a2563e65d2913ffcb671e5 100644 (file)
@@ -8,6 +8,7 @@
 #include "include/ceph_assert.h"
 #include "librbd/ImageState.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/deep_copy/MetadataCopyRequest.h"
 #include "librbd/image/AttachChildRequest.h"
 #include "librbd/image/AttachParentRequest.h"
@@ -46,7 +47,7 @@ CloneRequest<I>::CloneRequest(
     cls::rbd::MirrorImageMode mirror_image_mode,
     const std::string &non_primary_global_image_id,
     const std::string &primary_mirror_uuid,
-    ContextWQ *op_work_queue, Context *on_finish)
+    asio::ContextWQ *op_work_queue, Context *on_finish)
   : m_config(config), m_parent_io_ctx(parent_io_ctx),
     m_parent_image_id(parent_image_id), m_parent_snap_name(parent_snap_name),
     m_parent_snap_namespace(parent_snap_namespace),
index 1aa06d9c3c1795c81a1898bcce277c41ad18aebd..35d9cab17ed19913fe9d4bbc078cc5dc75cf8fc2 100644 (file)
@@ -14,6 +14,9 @@ class Context;
 using librados::IoCtx;
 
 namespace librbd {
+
+namespace asio { struct ContextWQ; }
+
 namespace image {
 
 template <typename ImageCtxT = ImageCtx>
@@ -30,7 +33,7 @@ public:
       cls::rbd::MirrorImageMode mirror_image_mode,
       const std::string &non_primary_global_image_id,
       const std::string &primary_mirror_uuid,
-      ContextWQ *op_work_queue, Context *on_finish) {
+      asio::ContextWQ *op_work_queue, Context *on_finish) {
     return new CloneRequest(config, parent_io_ctx, parent_image_id,
                             parent_snap_name, parent_snap_namespace,
                             parent_snap_id, c_ioctx, c_name, c_id, c_options,
@@ -48,7 +51,7 @@ public:
                cls::rbd::MirrorImageMode mirror_image_mode,
                const std::string &non_primary_global_image_id,
                const std::string &primary_mirror_uuid,
-               ContextWQ *op_work_queue, Context *on_finish);
+               asio::ContextWQ *op_work_queue, Context *on_finish);
 
   void send();
 
@@ -116,7 +119,7 @@ private:
   const std::string m_non_primary_global_image_id;
   const std::string m_primary_mirror_uuid;
   NoOpProgressContext m_no_op;
-  ContextWQ *m_op_work_queue;
+  asio::ContextWQ *m_op_work_queue;
   Context *m_on_finish;
 
   CephContext *m_cct;
index 5768b6ef7aadf91f2773bdbbfbaf24ccad9056e4..95460268251e1cfdb1b679d8e00496ee9c20d11c 100644 (file)
@@ -10,6 +10,7 @@
 #include "librbd/ImageWatcher.h"
 #include "librbd/ObjectMap.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/ImageDispatcher.h"
 #include "librbd/io/ImageDispatchSpec.h"
index 83c75141cc0d0b8c2b8b9f0cd904bb26bf41b0f9..abf434920945abeedd0100564a7a8d268aaa09b1 100644 (file)
 #include "librbd/Journal.h"
 #include "librbd/ObjectMap.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/image/Types.h"
 #include "librbd/image/ValidatePoolRequest.h"
 #include "librbd/journal/CreateRequest.h"
 #include "librbd/journal/RemoveRequest.h"
+#include "librbd/journal/TypeTraits.h"
 #include "librbd/mirror/EnableRequest.h"
 #include "journal/Journaler.h"
 
@@ -119,7 +121,8 @@ CreateRequest<I>::CreateRequest(const ConfigProxy& config, IoCtx &ioctx,
                                 cls::rbd::MirrorImageMode mirror_image_mode,
                                 const std::string &non_primary_global_image_id,
                                 const std::string &primary_mirror_uuid,
-                                ContextWQ *op_work_queue, Context *on_finish)
+                                asio::ContextWQ *op_work_queue,
+                                Context *on_finish)
   : m_config(config), m_image_name(image_name), m_image_id(image_id),
     m_size(size), m_create_flags(create_flags),
     m_mirror_image_mode(mirror_image_mode),
@@ -613,10 +616,13 @@ void CreateRequest<I>::journal_create() {
   tag_data.mirror_uuid = (use_primary_mirror_uuid ? m_primary_mirror_uuid :
                           librbd::Journal<I>::LOCAL_MIRROR_UUID);
 
+  typename journal::TypeTraits<I>::ContextWQ* context_wq;
+  Journal<>::get_work_queue(m_cct, &context_wq);
+
   auto req = librbd::journal::CreateRequest<I>::create(
     m_io_ctx, m_image_id, m_journal_order, m_journal_splay_width,
     m_journal_pool, cls::journal::Tag::TAG_CLASS_NEW, tag_data,
-    librbd::Journal<I>::IMAGE_CLIENT_ID, m_op_work_queue, ctx);
+    librbd::Journal<I>::IMAGE_CLIENT_ID, context_wq, ctx);
   req->send();
 }
 
@@ -697,9 +703,12 @@ void CreateRequest<I>::journal_remove() {
   Context *ctx = create_context_callback<klass, &klass::handle_journal_remove>(
     this);
 
+  typename journal::TypeTraits<I>::ContextWQ* context_wq;
+  Journal<>::get_work_queue(m_cct, &context_wq);
+
   librbd::journal::RemoveRequest<I> *req =
     librbd::journal::RemoveRequest<I>::create(
-      m_io_ctx, m_image_id, librbd::Journal<I>::IMAGE_CLIENT_ID, m_op_work_queue,
+      m_io_ctx, m_image_id, librbd::Journal<I>::IMAGE_CLIENT_ID, context_wq,
       ctx);
   req->send();
 }
index ce924e34ae31c5de22d337d2d24f5b43feae5cbf..9cb0eec7c8d2d86a3aa6a6e1f4480e18d4d355ed 100644 (file)
 #include "librbd/ImageCtx.h"
 
 class Context;
-class ContextWQ;
 
 using librados::IoCtx;
 
 namespace journal { class Journaler; }
 
 namespace librbd {
+
+namespace asio { struct ContextWQ; }
+
 namespace image {
 
 template <typename ImageCtxT = ImageCtx>
@@ -33,7 +35,8 @@ public:
                                cls::rbd::MirrorImageMode mirror_image_mode,
                                const std::string &non_primary_global_image_id,
                                const std::string &primary_mirror_uuid,
-                               ContextWQ *op_work_queue, Context *on_finish) {
+                               asio::ContextWQ *op_work_queue,
+                               Context *on_finish) {
     return new CreateRequest(config, ioctx, image_name, image_id, size,
                              image_options, create_flags,
                              mirror_image_mode, non_primary_global_image_id,
@@ -95,7 +98,7 @@ private:
                 cls::rbd::MirrorImageMode mirror_image_mode,
                 const std::string &non_primary_global_image_id,
                 const std::string &primary_mirror_uuid,
-                ContextWQ *op_work_queue, Context *on_finish);
+                asio::ContextWQ *op_work_queue, Context *on_finish);
 
   const ConfigProxy& m_config;
   IoCtx m_io_ctx;
@@ -118,7 +121,7 @@ private:
   const std::string m_primary_mirror_uuid;
   bool m_negotiate_features = false;
 
-  ContextWQ *m_op_work_queue;
+  asio::ContextWQ *m_op_work_queue;
   Context *m_on_finish;
 
   CephContext *m_cct;
index d84a0edff115fc7fae4675b6774e73b7bbe3b4c5..6cd279329337bd0c3df520127cfa42aefd7f2e1d 100644 (file)
@@ -4,13 +4,13 @@
 #include "librbd/image/DetachChildRequest.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/DisabledPolicy.h"
 #include "librbd/trash/RemoveRequest.h"
 #include <string>
index 40ff44b7a63a4bb3c06ee2258e0884768c059f38..74b1b0f672f093c76b93c0bc1f21bc5cde99a652 100644 (file)
@@ -4,7 +4,6 @@
 #include "librbd/image/DetachParentRequest.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
index 2423c4c885b91548c3fce90d8ade425f21a65fd1..8cc0cf949a0f2f1d4e891763cc5ab7e32fce89a1 100644 (file)
@@ -5,9 +5,9 @@
 #include "include/rados/librados.hpp"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/image/CloseRequest.h"
 #include "librbd/image/OpenRequest.h"
 #include "librbd/io/ObjectDispatcherInterface.h"
index a708e9d62c4cdb7f88b8c085a21706518d1a6e58..3142b7e3928cefa7b04d1dc8af514a6c7b355b57 100644 (file)
@@ -11,6 +11,7 @@
 #include "librbd/image/DetachChildRequest.h"
 #include "librbd/image/PreRemoveRequest.h"
 #include "librbd/journal/RemoveRequest.h"
+#include "librbd/journal/TypeTraits.h"
 #include "librbd/mirror/DisableRequest.h"
 #include "librbd/operation/TrimRequest.h"
 
@@ -322,8 +323,11 @@ void RemoveRequest<I>::send_journal_remove() {
   Context *ctx = create_context_callback<
     klass, &klass::handle_journal_remove>(this);
 
+  typename journal::TypeTraits<I>::ContextWQ* context_wq;
+  Journal<I>::get_work_queue(m_cct, &context_wq);
+
   journal::RemoveRequest<I> *req = journal::RemoveRequest<I>::create(
-    m_ioctx, m_image_id, Journal<>::IMAGE_CLIENT_ID, m_op_work_queue, ctx);
+    m_ioctx, m_image_id, Journal<>::IMAGE_CLIENT_ID, context_wq, ctx);
   req->send();
 }
 
index 98d597645a4913bfc418bf46526f96be36de25dd..79512c932ce2ab7006aab11a1932add8b0f3023b 100644 (file)
@@ -11,7 +11,6 @@
 #include <list>
 
 class Context;
-class ContextWQ;
 class SafeTimer;
 
 namespace librbd {
index 17d84fc8e6b5e326bc95149d09867486afb5e7a5..2989e30b5c487bba9985d12e8260bebc2763b62b 100644 (file)
@@ -4,14 +4,15 @@
 #ifndef CEPH_LIBRBD_IMAGE_TYPE_TRAITS_H
 #define CEPH_LIBRBD_IMAGE_TYPE_TRAITS_H
 
-class ContextWQ;
-
 namespace librbd {
+
+namespace asio { struct ContextWQ; }
+
 namespace image {
 
 template <typename ImageCtxT>
 struct TypeTraits {
-  typedef ::ContextWQ ContextWQ;
+  typedef asio::ContextWQ ContextWQ;
 };
 
 } // namespace image
index 9e4af7bf9904d76d20c50f24f54289ee98e83949..9e685dc477c7551ee6efba1f6ada7633e5fbe8fd 100644 (file)
@@ -6,9 +6,9 @@
 #include "include/ceph_assert.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 
 #define dout_subsys ceph_subsys_rbd
 #undef dout_prefix
@@ -31,7 +31,7 @@ using util::create_async_context_callback;
 
 template <typename I>
 ValidatePoolRequest<I>::ValidatePoolRequest(librados::IoCtx& io_ctx,
-                                            ContextWQ *op_work_queue,
+                                            asio::ContextWQ *op_work_queue,
                                             Context *on_finish)
     : m_cct(reinterpret_cast<CephContext*>(io_ctx.cct())),
       m_op_work_queue(op_work_queue), m_on_finish(on_finish) {
index 38c4de7c69a18ce9fb7d2bd9bcf0d99e5e76aa9c..859bf4e13e3ee23de354177e66506f23ea4cc896 100644 (file)
@@ -9,11 +9,11 @@
 #include "include/buffer.h"
 
 class Context;
-class ContextWQ;
 
 namespace librbd {
 
 struct ImageCtx;
+namespace asio { struct ContextWQ; }
 
 namespace image {
 
@@ -21,12 +21,12 @@ template <typename ImageCtxT>
 class ValidatePoolRequest {
 public:
   static ValidatePoolRequest* create(librados::IoCtx& io_ctx,
-                                     ContextWQ *op_work_queue,
+                                     asio::ContextWQ *op_work_queue,
                                      Context *on_finish) {
     return new ValidatePoolRequest(io_ctx, op_work_queue, on_finish);
   }
 
-  ValidatePoolRequest(librados::IoCtx& io_ctx, ContextWQ *op_work_queue,
+  ValidatePoolRequest(librados::IoCtx& io_ctx, asio::ContextWQ *op_work_queue,
                       Context *on_finish);
 
   void send();
@@ -62,7 +62,7 @@ private:
 
   librados::IoCtx m_io_ctx;
   CephContext* m_cct;
-  ContextWQ* m_op_work_queue;
+  asio::ContextWQ* m_op_work_queue;
   Context* m_on_finish;
 
   int m_ret_val = 0;
index 31edcc57b600038d6e9a7c95ba293d5c2548b7af..62c911ae5f2f16727c1c4ca3c84406a8c277e4d3 100644 (file)
@@ -684,7 +684,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
       lderr(cct) << "Forced V1 image creation. " << dendl;
       r = create_v1(io_ctx, image_name.c_str(), size, order);
     } else {
-      ContextWQ *op_work_queue;
+      asio::ContextWQ *op_work_queue;
       ImageCtx::get_work_queue(cct, &op_work_queue);
 
       ConfigProxy config{cct->_conf};
@@ -789,7 +789,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     ConfigProxy config{reinterpret_cast<CephContext *>(c_ioctx.cct())->_conf};
     api::Config<>::apply_pool_overrides(c_ioctx, &config);
 
-    ContextWQ *op_work_queue;
+    asio::ContextWQ *op_work_queue;
     ImageCtx::get_work_queue(cct, &op_work_queue);
 
     C_SaferCond cond;
index 58801019d7fee177b56fb8fec3a49a6ee6583e1e..9bd03228a54ebade4065daba05b893fa854a3b8d 100644 (file)
@@ -14,7 +14,6 @@
 #include "include/rbd/librbd.hpp"
 #include "include/rbd_types.h"
 #include "cls/rbd/cls_rbd_types.h"
-#include "common/WorkQueue.h"
 #include "common/ceph_time.h"
 #include "librbd/Types.h"
 
index 9ebb334a2b153ed8969a7a6bddf8032a64da00ac..dc933a12084f12c05da7eb29305df83192c18ff9 100644 (file)
@@ -8,12 +8,12 @@
 #include "common/dout.h"
 #include "common/errno.h"
 #include "common/perf_counters.h"
-#include "common/WorkQueue.h"
 
 #include "librbd/ImageCtx.h"
 #include "librbd/internal.h"
 #include "librbd/Journal.h"
 #include "librbd/Types.h"
+#include "librbd/asio/ContextWQ.h"
 
 #ifdef WITH_LTTNG
 #include "tracing/librbd.h"
index 2a00cd6699ac42914881a7c1b619576708b8fe4a..4c4d508e7d25357745030fc2e70e6aba7968cc1f 100644 (file)
@@ -3,8 +3,8 @@
 
 #include "librbd/io/AsyncOperation.h"
 #include "librbd/ImageCtx.h"
+#include "librbd/asio/ContextWQ.h"
 #include "common/dout.h"
-#include "common/WorkQueue.h"
 #include "include/ceph_assert.h"
 
 #define dout_subsys ceph_subsys_rbd
index 94b80ecca1e86e8f95e79209db9e9dbe62f2ae35..d41573d693112c64dce48c081f1e9488de1363a4 100644 (file)
@@ -6,12 +6,12 @@
 #include "common/ceph_mutex.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/AsyncObjectThrottle.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ObjectMap.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/deep_copy/ObjectCopyRequest.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/ImageRequest.h"
index 0191cabacd79833f8ff0a11d83efee9b5fea6707..21262e591ff8ac27a3c65adee73b38c6d013044e 100644 (file)
@@ -3,7 +3,6 @@
 
 #include "librbd/io/ImageDispatch.h"
 #include "common/dout.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/ImageRequest.h"
index c6b8807935c429f551cef126924b067174bad9ff..041265434aa0926e87cdead998e4f4784d6fd7e2 100644 (file)
@@ -5,7 +5,6 @@
 #include "include/Context.h"
 #include "common/AsyncOpTracker.h"
 #include "common/dout.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
 #include "librbd/io/AsyncOperation.h"
index 141f8f12740211304d5de10507856fc563e0218a..d4a15645fb5070ddb3fa4881753ef1a3abe023bd 100644 (file)
@@ -7,6 +7,7 @@
 #include "librbd/Journal.h"
 #include "librbd/Types.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/cache/ImageCache.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/AsyncOperation.h"
@@ -17,7 +18,6 @@
 #include "librbd/journal/Types.h"
 #include "include/rados/librados.hpp"
 #include "common/perf_counters.h"
-#include "common/WorkQueue.h"
 #include "osdc/Striper.h"
 #include <algorithm>
 #include <functional>
index 4f3baa451f7e739b0283e5176f9c7f32a34203f3..ecf9ae23d078798a18f31108579719b502522c50 100644 (file)
@@ -3,9 +3,9 @@
 
 #include "librbd/io/ObjectDispatch.h"
 #include "common/dout.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/ObjectRequest.h"
 
 #define dout_subsys ceph_subsys_rbd
index 25ed4989c3eb9e64d90d625d21aa61df6a344e2f..7c46fdff75d2d5d3c4eadbf1a55bbafe9080a729 100644 (file)
@@ -5,9 +5,9 @@
 #include "include/Context.h"
 #include "common/AsyncOpTracker.h"
 #include "common/dout.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/ObjectDispatch.h"
 #include "librbd/io/ObjectDispatchSpec.h"
 #include <boost/variant.hpp>
index 3966dd2e725b5f01a8ca0fbdf16b6e4169eccfa0..51efbae21efb77d82ea2fd5142d48e65d91f19a6 100644 (file)
@@ -6,7 +6,6 @@
 #include "common/dout.h"
 #include "common/errno.h"
 #include "common/ceph_mutex.h"
-#include "common/WorkQueue.h"
 #include "include/Context.h"
 #include "include/err.h"
 #include "osd/osd_types.h"
@@ -15,6 +14,7 @@
 #include "librbd/ImageCtx.h"
 #include "librbd/ObjectMap.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/CopyupRequest.h"
 #include "librbd/io/ImageRequest.h"
index 31293e1e589b2608d996ad0533852c33374937c2..f19471f8d73f35f36efa287b9060a11690fa0ea9 100644 (file)
@@ -3,8 +3,8 @@
 
 #include "librbd/io/QosImageDispatch.h"
 #include "common/dout.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/FlushTracker.h"
 #include <map>
 
index 0114fefa0988c434518735b4bc2a1f3f5339e98e..d901d2ebbd0bef13ec22225f0fa812b21404812f 100644 (file)
@@ -4,9 +4,9 @@
 #include "librbd/io/QueueImageDispatch.h"
 #include "common/dout.h"
 #include "common/Cond.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/ImageDispatchSpec.h"
 
index bae5f2044259b4ec35b178581200ab369ed9a93a..ec9c3b434084f8ac71e7a6f2ca5159e5232cd5e0 100644 (file)
@@ -3,10 +3,10 @@
 
 #include "librbd/io/SimpleSchedulerObjectDispatch.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "common/errno.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/ObjectDispatchSpec.h"
 #include "librbd/io/ObjectDispatcher.h"
 #include "librbd/io/Utils.h"
index ab69b3d85f36004d1e7e0f14d1ae122ca8e41972..d6672de6016411888b2289ad7a56e2e17f0b7ac7 100644 (file)
@@ -4,9 +4,9 @@
 #include "librbd/io/WriteBlockImageDispatch.h"
 #include "common/dout.h"
 #include "common/Cond.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/ImageDispatchSpec.h"
 
index 46f0d81d1b9cfc07d2689cc3c3f1c8bf7f83b8d5..4f7a0f5bedd174dab72cafa732b82a3922ab3f84 100644 (file)
@@ -6,7 +6,6 @@
 #include "include/ceph_assert.h"
 #include "librbd/Utils.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "journal/Settings.h"
 #include "librbd/journal/CreateRequest.h"
 #include "librbd/journal/RemoveRequest.h"
index 649388266b08c6c7eb2cceb3434e7eeebb705cfb..564391978956cebd874b4ca0df066aa5384a2c48 100644 (file)
@@ -4,12 +4,12 @@
 #include "librbd/journal/DemoteRequest.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "journal/Journaler.h"
 #include "journal/Settings.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/OpenRequest.h"
 
 #define dout_subsys ceph_subsys_rbd
index b3db10080074de1edae0aed6ab3bec083b72517a..91dae20d76107e8a8800aff838e5c57a1e03b7e3 100644 (file)
@@ -3,11 +3,11 @@
 
 #include "librbd/journal/ObjectDispatch.h"
 #include "common/dout.h"
-#include "common/WorkQueue.h"
 #include "osdc/Striper.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/ObjectDispatchSpec.h"
 #include "librbd/io/ObjectDispatcherInterface.h"
 
index e0cde38d0c3542ee9e3a362e75584dac5b5e735d..eb01aa35a280eefd3e00dfe0b16a716f61432632 100644 (file)
@@ -4,11 +4,11 @@
 #include "librbd/journal/OpenRequest.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "journal/Journaler.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/Types.h"
 #include "librbd/journal/Utils.h"
 
index 703a8a075bc06d0ba0120d02968d9459ddc51a2e..f7ae45a926c5e1250258427744cc0082f23373f2 100644 (file)
@@ -4,12 +4,12 @@
 #include "librbd/journal/PromoteRequest.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "journal/Journaler.h"
 #include "journal/Settings.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/OpenRequest.h"
 
 #define dout_subsys ceph_subsys_rbd
index 6bdabf40093f5361ac9d00cb24a2ec8e3c1f9fe3..0f73a31bac0676b0ae19268f309ded49e6ba83d3 100644 (file)
@@ -4,7 +4,6 @@
 #include "common/dout.h"
 #include "common/errno.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "journal/Settings.h"
 #include "include/ceph_assert.h"
 #include "librbd/Utils.h"
index 9efeeae0b114f065dbd6bcd411ec7a3ff66c9b13..e73b37092326bd1a1aed7b63e1242ec28fc689de 100644 (file)
@@ -4,13 +4,13 @@
 #include "librbd/journal/Replay.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/internal.h"
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/io/ImageRequest.h"
 
index 58631801703ab75abc21551f11bdc47950cae0f7..7f124aeef7c9dd933bdd1f1c766f34ad6d3f3ed4 100644 (file)
@@ -2,9 +2,9 @@
 // vim: ts=8 sw=2 smarttab
 
 #include "librbd/journal/StandardPolicy.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Journal.h"
+#include "librbd/asio/ContextWQ.h"
 
 #define dout_subsys ceph_subsys_rbd
 #undef dout_prefix
index d6dde690d8567e65dd014d5a08c30656818b8696..51b025f6d575f0fc6746a679ff55732132581118 100644 (file)
@@ -4,6 +4,8 @@
 #ifndef CEPH_LIBRBD_JOURNAL_TYPE_TRAITS_H
 #define CEPH_LIBRBD_JOURNAL_TYPE_TRAITS_H
 
+struct ContextWQ;
+
 namespace journal {
 class Future;
 class Journaler;
@@ -18,6 +20,7 @@ struct TypeTraits {
   typedef ::journal::Journaler Journaler;
   typedef ::journal::Future Future;
   typedef ::journal::ReplayEntry ReplayEntry;
+  typedef ::ContextWQ ContextWQ;
 };
 
 } // namespace journal
index 9b3e5e8776c6079ce18127a813db981148b227bd..f1c2bbd50a27aebb1ac8a1edc98b300af4ff89bd 100644 (file)
@@ -7,10 +7,10 @@
 #include "cls/lock/cls_lock_types.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "include/stringify.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/managed_lock/BreakRequest.h"
 #include "librbd/managed_lock/GetLockerRequest.h"
 #include "librbd/managed_lock/Utils.h"
@@ -33,7 +33,7 @@ namespace managed_lock {
 template <typename I>
 AcquireRequest<I>* AcquireRequest<I>::create(librados::IoCtx& ioctx,
                                              Watcher *watcher,
-                                             ContextWQ *work_queue,
+                                             asio::ContextWQ *work_queue,
                                              const string& oid,
                                              const string& cookie,
                                              bool exclusive,
@@ -47,7 +47,8 @@ AcquireRequest<I>* AcquireRequest<I>::create(librados::IoCtx& ioctx,
 
 template <typename I>
 AcquireRequest<I>::AcquireRequest(librados::IoCtx& ioctx, Watcher *watcher,
-                                  ContextWQ *work_queue, const string& oid,
+                                  asio::ContextWQ *work_queue,
+                                  const string& oid,
                                   const string& cookie, bool exclusive,
                                   bool blacklist_on_break_lock,
                                   uint32_t blacklist_expire_seconds,
@@ -58,7 +59,7 @@ AcquireRequest<I>::AcquireRequest(librados::IoCtx& ioctx, Watcher *watcher,
     m_exclusive(exclusive),
     m_blacklist_on_break_lock(blacklist_on_break_lock),
     m_blacklist_expire_seconds(blacklist_expire_seconds),
-    m_on_finish(new C_AsyncCallback<ContextWQ>(work_queue, on_finish)) {
+    m_on_finish(new C_AsyncCallback<asio::ContextWQ>(work_queue, on_finish)) {
 }
 
 template <typename I>
index 20af0693349432bbfaa0b22d3f69e3d7691bec63..56e85bfb7334c3f5113e1f3bf72eb031e732e31f 100644 (file)
 #include <string>
 
 class Context;
-class ContextWQ;
 
 namespace librbd {
 
 class Watcher;
+namespace asio { struct ContextWQ; }
 
 namespace managed_lock {
 
@@ -29,7 +29,8 @@ private:
 
 public:
   static AcquireRequest* create(librados::IoCtx& ioctx, Watcher *watcher,
-                                ContextWQ *work_queue, const std::string& oid,
+                                asio::ContextWQ *work_queue,
+                                const std::string& oid,
                                 const std::string& cookie,
                                 bool exclusive,
                                 bool blacklist_on_break_lock,
@@ -63,7 +64,7 @@ private:
    */
 
   AcquireRequest(librados::IoCtx& ioctx, Watcher *watcher,
-                 ContextWQ *work_queue, const std::string& oid,
+                 asio::ContextWQ *work_queue, const std::string& oid,
                  const std::string& cookie, bool exclusive,
                  bool blacklist_on_break_lock,
                  uint32_t blacklist_expire_seconds, Context *on_finish);
@@ -71,7 +72,7 @@ private:
   librados::IoCtx& m_ioctx;
   Watcher *m_watcher;
   CephContext *m_cct;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
   std::string m_oid;
   std::string m_cookie;
   bool m_exclusive;
index 8caaea6ff96d65d7ed8c8a8e63b6b0768f998b67..d007380e3ae5894720b29d4d5338de5890aa34e9 100644 (file)
@@ -4,12 +4,12 @@
 #include "librbd/managed_lock/BreakRequest.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "include/stringify.h"
 #include "cls/lock/cls_lock_client.h"
 #include "cls/lock/cls_lock_types.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/managed_lock/GetLockerRequest.h"
 
 #define dout_subsys ceph_subsys_rbd
@@ -47,7 +47,8 @@ struct C_BlacklistClient : public Context {
 } // anonymous namespace
 
 template <typename I>
-BreakRequest<I>::BreakRequest(librados::IoCtx& ioctx, ContextWQ *work_queue,
+BreakRequest<I>::BreakRequest(librados::IoCtx& ioctx,
+                              asio::ContextWQ *work_queue,
                               const std::string& oid, const Locker &locker,
                               bool exclusive, bool blacklist_locker,
                               uint32_t blacklist_expire_seconds,
index 4531a3c575ee7b0496b67a596249c877dc2670b4..50bc0b0cb85e368ffd90b15c294bfc8db817896a 100644 (file)
@@ -21,13 +21,15 @@ namespace librbd {
 
 class ImageCtx;
 template <typename> class Journal;
+namespace asio { struct ContextWQ; }
 
 namespace managed_lock {
 
 template <typename ImageCtxT = ImageCtx>
 class BreakRequest {
 public:
-  static BreakRequest* create(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  static BreakRequest* create(librados::IoCtx& ioctx,
+                              asio::ContextWQ *work_queue,
                               const std::string& oid, const Locker &locker,
                               bool exclusive, bool blacklist_locker,
                               uint32_t blacklist_expire_seconds,
@@ -65,7 +67,7 @@ private:
 
   librados::IoCtx &m_ioctx;
   CephContext *m_cct;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
   std::string m_oid;
   Locker m_locker;
   bool m_exclusive;
@@ -81,7 +83,7 @@ private:
 
   Locker m_refreshed_locker;
 
-  BreakRequest(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  BreakRequest(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
                const std::string& oid, const Locker &locker,
                bool exclusive, bool blacklist_locker,
                uint32_t blacklist_expire_seconds, bool force_break_lock,
index d74e146252216fae4983e28e9084dd292810eb07..598ececab0518807f9599447b22769c7af91708f 100644 (file)
@@ -2,14 +2,14 @@
 // vim: ts=8 sw=2 smarttab
 
 #include "librbd/managed_lock/ReleaseRequest.h"
-#include "librbd/Watcher.h"
 #include "cls/lock/cls_lock_client.h"
 #include "cls/lock/cls_lock_types.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "librbd/Utils.h"
-
 #include "librbd/ImageCtx.h"
+#include "librbd/Utils.h"
+#include "librbd/Watcher.h"
+#include "librbd/asio/ContextWQ.h"
 
 #define dout_subsys ceph_subsys_rbd
 #undef dout_prefix
@@ -26,7 +26,7 @@ using util::create_rados_callback;
 template <typename I>
 ReleaseRequest<I>* ReleaseRequest<I>::create(librados::IoCtx& ioctx,
                                              Watcher *watcher,
-                                             ContextWQ *work_queue,
+                                             asio::ContextWQ *work_queue,
                                              const string& oid,
                                              const string& cookie,
                                              Context *on_finish) {
@@ -36,10 +36,11 @@ ReleaseRequest<I>* ReleaseRequest<I>::create(librados::IoCtx& ioctx,
 
 template <typename I>
 ReleaseRequest<I>::ReleaseRequest(librados::IoCtx& ioctx, Watcher *watcher,
-                                  ContextWQ *work_queue, const string& oid,
-                                  const string& cookie, Context *on_finish)
+                                  asio::ContextWQ *work_queue,
+                                  const string& oid, const string& cookie,
+                                  Context *on_finish)
   : m_ioctx(ioctx), m_watcher(watcher), m_oid(oid), m_cookie(cookie),
-    m_on_finish(new C_AsyncCallback<ContextWQ>(work_queue, on_finish)) {
+    m_on_finish(new C_AsyncCallback<asio::ContextWQ>(work_queue, on_finish)) {
 }
 
 template <typename I>
index 89205136ecf11a72c3c6c60065a9700f6c8070c2..91d9222821ca490cd3066445e783e459fe46d889 100644 (file)
@@ -14,6 +14,7 @@ class ContextWQ;
 namespace librbd {
 
 class Watcher;
+namespace asio { struct ContextWQ; }
 
 namespace managed_lock {
 
@@ -25,7 +26,7 @@ private:
 
 public:
   static ReleaseRequest* create(librados::IoCtx& ioctx, Watcher *watcher,
-                                ContextWQ *work_queue,
+                                asio::ContextWQ *work_queue,
                                 const std::string& oid,
                                 const std::string& cookie,
                                 Context *on_finish);
@@ -49,7 +50,7 @@ private:
    */
 
   ReleaseRequest(librados::IoCtx& ioctx, Watcher *watcher,
-                 ContextWQ *work_queue, const std::string& oid,
+                 asio::ContextWQ *work_queue, const std::string& oid,
                  const std::string& cookie, Context *on_finish);
 
   librados::IoCtx& m_ioctx;
index 05652d1c9dd3c6e705ee2e46cc4541b3b1492696..09378ce58b895b46b90b87f54254f78afe4996c6 100644 (file)
@@ -2,7 +2,6 @@
 // vim: ts=8 sw=2 smarttab
 
 #include "librbd/mirror/DisableRequest.h"
-#include "common/WorkQueue.h"
 #include "common/dout.h"
 #include "common/errno.h"
 #include "cls/journal/cls_journal_client.h"
@@ -12,6 +11,7 @@
 #include "librbd/Journal.h"
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/PromoteRequest.h"
 #include "librbd/mirror/GetInfoRequest.h"
 #include "librbd/mirror/ImageRemoveRequest.h"
index cd276fdfe852a05e7e355abea9a68594b63736f5..d81dd9201a3a5284b23524749254061ced371c4b 100644 (file)
@@ -28,7 +28,8 @@ EnableRequest<I>::EnableRequest(librados::IoCtx &io_ctx,
                                 I* image_ctx,
                                 cls::rbd::MirrorImageMode mode,
                                 const std::string &non_primary_global_image_id,
-                                bool image_clean, ContextWQ *op_work_queue,
+                                bool image_clean,
+                                asio::ContextWQ *op_work_queue,
                                 Context *on_finish)
   : m_io_ctx(io_ctx), m_image_id(image_id), m_image_ctx(image_ctx),
     m_mode(mode), m_non_primary_global_image_id(non_primary_global_image_id),
index 574dfe2bc03d091dd8107d375d1810385ac18c02..64f410a8e066e671eb2d188b92b787c6416a90a2 100644 (file)
 #include <string>
 
 class Context;
-class ContextWQ;
 
 namespace librbd {
+
+namespace asio { struct ContextWQ; }
+
 namespace mirror {
 
 template <typename ImageCtxT = ImageCtx>
@@ -34,7 +36,7 @@ public:
                                const std::string &image_id,
                                cls::rbd::MirrorImageMode mode,
                                const std::string &non_primary_global_image_id,
-                               bool image_clean, ContextWQ *op_work_queue,
+                               bool image_clean, asio::ContextWQ *op_work_queue,
                                Context *on_finish) {
     return new EnableRequest(io_ctx, image_id, nullptr, mode,
                              non_primary_global_image_id, image_clean,
@@ -79,7 +81,8 @@ private:
   EnableRequest(librados::IoCtx &io_ctx, const std::string &image_id,
                 ImageCtxT* image_ctx, cls::rbd::MirrorImageMode mode,
                 const std::string &non_primary_global_image_id,
-                bool image_clean, ContextWQ *op_work_queue, Context *on_finish);
+                bool image_clean, asio::ContextWQ *op_work_queue,
+                Context *on_finish);
 
   librados::IoCtx &m_io_ctx;
   std::string m_image_id;
@@ -87,7 +90,7 @@ private:
   cls::rbd::MirrorImageMode m_mode;
   std::string m_non_primary_global_image_id;
   bool m_image_clean;
-  ContextWQ *m_op_work_queue;
+  asio::ContextWQ *m_op_work_queue;
   Context *m_on_finish;
 
   CephContext *m_cct = nullptr;
index 4ec529ba89807951ba477bdc70056a1a66c60501..a7ee645670413f785b2d6dd2e9039bd1fdff4976 100644 (file)
@@ -23,7 +23,7 @@ using librbd::util::create_rados_callback;
 
 template <typename I>
 GetInfoRequest<I>::GetInfoRequest(librados::IoCtx& io_ctx,
-                                  ContextWQ *op_work_queue,
+                                  asio::ContextWQ *op_work_queue,
                                   const std::string &image_id,
                                   cls::rbd::MirrorImage *mirror_image,
                                   PromotionState *promotion_state,
index def31a4264ac6cbe2a59444aaa1a55a00003e9d3..dcc6da7da975fe570c99ed1faf71759e3ce7e3f5 100644 (file)
@@ -12,7 +12,6 @@
 #include "librbd/mirror/Types.h"
 #include <string>
 
-class ContextWQ;
 struct Context;
 
 namespace cls { namespace rbd { struct MirrorImage; } }
@@ -20,6 +19,7 @@ namespace cls { namespace rbd { struct MirrorImage; } }
 namespace librbd {
 
 struct ImageCtx;
+namespace asio { struct ContextWQ; }
 
 namespace mirror {
 
@@ -27,7 +27,7 @@ template <typename ImageCtxT = librbd::ImageCtx>
 class GetInfoRequest {
 public:
   static GetInfoRequest *create(librados::IoCtx &io_ctx,
-                                ContextWQ *op_work_queue,
+                                asio::ContextWQ *op_work_queue,
                                 const std::string &image_id,
                                 cls::rbd::MirrorImage *mirror_image,
                                 PromotionState *promotion_state,
@@ -45,7 +45,7 @@ public:
                               primary_mirror_uuid, on_finish);
   }
 
-  GetInfoRequest(librados::IoCtx& io_ctx, ContextWQ *op_work_queue,
+  GetInfoRequest(librados::IoCtx& io_ctx, asio::ContextWQ *op_work_queue,
                  const std::string &image_id,
                  cls::rbd::MirrorImage *mirror_image,
                  PromotionState *promotion_state,
@@ -83,7 +83,7 @@ private:
 
   ImageCtxT *m_image_ctx = nullptr;
   librados::IoCtx &m_io_ctx;
-  ContextWQ *m_op_work_queue;
+  asio::ContextWQ *m_op_work_queue;
   std::string m_image_id;
   cls::rbd::MirrorImage *m_mirror_image;
   PromotionState *m_promotion_state;
index f9cf4b5b973dd67d66dcf228bb1df16a978581f2..a9e2fb95ccf6a675e20aae8c96246c76b5148a14 100644 (file)
@@ -11,6 +11,7 @@
 #include "librbd/ImageState.h"
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/image/ListWatchersRequest.h"
 #include "librbd/mirror/snapshot/CreateNonPrimaryRequest.h"
 #include "librbd/mirror/snapshot/CreatePrimaryRequest.h"
index f24138ff338633f8e12b2451ad1a060575213c22..9fdd5ed71a5d9c1d893c9d3f8dc9dc80e27b9a65 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "include/buffer.h"
 #include "include/rbd/librbd.hpp"
+#include "common/ceph_mutex.h"
 #include "librbd/internal.h"
 
 #include <string>
index d93da2acd454e6594fd2f926a70266d838912274..dafbf422c8db761ea96c8bdae8229ac61ade6803 100644 (file)
@@ -13,6 +13,7 @@
 #include "librbd/image/SetFlagsRequest.h"
 #include "librbd/io/ImageDispatcherInterface.h"
 #include "librbd/journal/RemoveRequest.h"
+#include "librbd/journal/TypeTraits.h"
 #include "librbd/mirror/DisableRequest.h"
 #include "librbd/object_map/RemoveRequest.h"
 
@@ -401,9 +402,12 @@ void DisableFeaturesRequest<I>::send_remove_journal() {
     DisableFeaturesRequest<I>,
     &DisableFeaturesRequest<I>::handle_remove_journal>(this);
 
+  typename journal::TypeTraits<I>::ContextWQ* context_wq;
+  Journal<I>::get_work_queue(cct, &context_wq);
+
   journal::RemoveRequest<I> *req = journal::RemoveRequest<I>::create(
     image_ctx.md_ctx, image_ctx.id, librbd::Journal<>::IMAGE_CLIENT_ID,
-    image_ctx.op_work_queue, ctx);
+    context_wq, ctx);
 
   req->send();
 }
index ee180107102b3d1d39be9afdcced0b33e574470f..8e3dad94b6797703d199c0d675e8068e47dae75f 100644 (file)
@@ -12,6 +12,7 @@
 #include "librbd/image/SetFlagsRequest.h"
 #include "librbd/io/ImageDispatcherInterface.h"
 #include "librbd/journal/CreateRequest.h"
+#include "librbd/journal/TypeTraits.h"
 #include "librbd/mirror/EnableRequest.h"
 #include "librbd/object_map/CreateRequest.h"
 
@@ -235,13 +236,16 @@ void EnableFeaturesRequest<I>::send_create_journal() {
     EnableFeaturesRequest<I>,
     &EnableFeaturesRequest<I>::handle_create_journal>(this);
 
+  typename journal::TypeTraits<I>::ContextWQ* context_wq;
+  Journal<I>::get_work_queue(cct, &context_wq);
+
   journal::CreateRequest<I> *req = journal::CreateRequest<I>::create(
     image_ctx.md_ctx, image_ctx.id,
     image_ctx.config.template get_val<uint64_t>("rbd_journal_order"),
     image_ctx.config.template get_val<uint64_t>("rbd_journal_splay_width"),
     image_ctx.config.template get_val<std::string>("rbd_journal_pool"),
     cls::journal::Tag::TAG_CLASS_NEW, tag_data,
-    librbd::Journal<>::IMAGE_CLIENT_ID, image_ctx.op_work_queue, ctx);
+    librbd::Journal<>::IMAGE_CLIENT_ID, context_wq, ctx);
 
   req->send();
 }
index 631d8dd5b201385a92961b7174a0cf90dcd73e46..269c8a4f99992290e841b50604b36fa79fe63e42 100644 (file)
@@ -4,8 +4,8 @@
 #include "librbd/operation/Request.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
+#include "librbd/asio/ContextWQ.h"
 
 #define dout_subsys ceph_subsys_rbd
 #undef dout_prefix
index 77cbfd81b4107a8251cf38d977d770d0fd39fcc6..bff30df6cec86092976ee670a43a69bb1e9f537e 100644 (file)
@@ -2,7 +2,6 @@
 // vim: ts=8 sw=2 smarttab
 
 #include "librbd/trash/RemoveRequest.h"
-#include "common/WorkQueue.h"
 #include "common/dout.h"
 #include "common/errno.h"
 #include "cls/rbd/cls_rbd_client.h"
@@ -10,6 +9,7 @@
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/image/RemoveRequest.h"
 
 #define dout_subsys ceph_subsys_rbd
index f9ac0fdb945abbbd9ecd9aa6576b52b54e18daba..86082ca4936eef78f3801cd45af4b605a8456221 100644 (file)
 #include <string>
 
 class Context;
-class ContextWQ;
 
 namespace librbd {
 
-class ProgressContext;
-
 struct ImageCtx;
+class ProgressContext;
+namespace asio { struct ContextWQ; }
 
 namespace trash {
 
@@ -26,14 +25,14 @@ class RemoveRequest {
 public:
   static RemoveRequest* create(librados::IoCtx &io_ctx,
                                const std::string &image_id,
-                               ContextWQ *op_work_queue, bool force,
+                               asio::ContextWQ *op_work_queue, bool force,
                                ProgressContext &prog_ctx, Context *on_finish) {
     return new RemoveRequest(io_ctx, image_id, op_work_queue, force, prog_ctx,
                              on_finish);
   }
 
   static RemoveRequest* create(librados::IoCtx &io_ctx, ImageCtxT *image_ctx,
-                               ContextWQ *op_work_queue, bool force,
+                               asio::ContextWQ *op_work_queue, bool force,
                                ProgressContext &prog_ctx, Context *on_finish) {
     return new RemoveRequest(io_ctx, image_ctx, op_work_queue, force, prog_ctx,
                              on_finish);
@@ -41,16 +40,16 @@ public:
 
 
   RemoveRequest(librados::IoCtx &io_ctx, const std::string &image_id,
-                ContextWQ *op_work_queue, bool force, ProgressContext &prog_ctx,
-                Context *on_finish)
+                asio::ContextWQ *op_work_queue, bool force,
+                ProgressContext &prog_ctx, Context *on_finish)
     : m_io_ctx(io_ctx), m_image_id(image_id), m_op_work_queue(op_work_queue),
       m_force(force), m_prog_ctx(prog_ctx), m_on_finish(on_finish),
       m_cct(reinterpret_cast<CephContext *>(io_ctx.cct())) {
   }
 
   RemoveRequest(librados::IoCtx &io_ctx, ImageCtxT *image_ctx,
-                ContextWQ *op_work_queue, bool force, ProgressContext &prog_ctx,
-                Context *on_finish)
+                asio::ContextWQ *op_work_queue, bool force,
+                ProgressContext &prog_ctx, Context *on_finish)
     : m_io_ctx(io_ctx), m_image_ctx(image_ctx), m_image_id(m_image_ctx->id),
       m_op_work_queue(op_work_queue), m_force(force), m_prog_ctx(prog_ctx),
       m_on_finish(on_finish),
@@ -83,7 +82,7 @@ private:
   librados::IoCtx &m_io_ctx;
   ImageCtxT *m_image_ctx = nullptr;
   std::string m_image_id;
-  ContextWQ *m_op_work_queue;
+  asio::ContextWQ *m_op_work_queue;
   bool m_force;
   ProgressContext &m_prog_ctx;
   Context *m_on_finish;
index 2715f25926261753d422b36fd89df1f78038f007..9a4134402976b2c269473477c4483d44e0df330a 100644 (file)
@@ -2,9 +2,9 @@
 // vim: ts=8 sw=2 smarttab
 
 #include "librbd/watcher/Notifier.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/watcher/Types.h"
 
 #define dout_subsys ceph_subsys_rbd
@@ -36,7 +36,8 @@ void Notifier::C_AioNotify::finish(int r) {
   notifier->handle_notify(r, on_finish);
 }
 
-Notifier::Notifier(ContextWQ *work_queue, IoCtx &ioctx, const std::string &oid)
+Notifier::Notifier(asio::ContextWQ *work_queue, IoCtx &ioctx,
+                   const std::string &oid)
   : m_work_queue(work_queue), m_ioctx(ioctx), m_oid(oid),
     m_aio_notify_lock(ceph::make_mutex(util::unique_lock_name(
       "librbd::object_watcher::Notifier::m_aio_notify_lock", this))) {
index 5bfb10399032fafcdf77f6886a0529ddb4c011dc..79546b50527ba14035f6307b50b6a2bd8aade537 100644 (file)
@@ -9,11 +9,12 @@
 #include "include/Context.h"
 #include "include/rados/librados.hpp"
 #include "common/ceph_mutex.h"
-#include "common/WorkQueue.h"
 #include <list>
 
 namespace librbd {
 
+namespace asio { struct ContextWQ; }
+
 namespace watcher {
 
 struct NotifyResponse;
@@ -22,7 +23,7 @@ class Notifier {
 public:
   static const uint64_t NOTIFY_TIMEOUT;
 
-  Notifier(ContextWQ *work_queue, librados::IoCtx &ioctx,
+  Notifier(asio::ContextWQ *work_queue, librados::IoCtx &ioctx,
            const std::string &oid);
   ~Notifier();
 
@@ -44,7 +45,7 @@ private:
     void finish(int r) override;
   };
 
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
   librados::IoCtx &m_ioctx;
   CephContext *m_cct;
   std::string m_oid;
index a7d68a624e2df985e43e4630fda4d1c9563ebac7..64a4173abd8009e09b731258466285229d39e84f 100644 (file)
@@ -174,7 +174,7 @@ public:
 
   librbd::ImageCtx *m_src_image_ctx;
   librbd::ImageCtx *m_dst_image_ctx;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
   librbd::SnapSeqs m_snap_seqs;
   SnapMap m_snap_map;
 
index 8d6fcd3ad8d3239d2843fe980e7d8d41cf58ff64..a44cd4cda3eaa65242c099aafaf2a1b08ceb228b 100644 (file)
@@ -79,7 +79,7 @@ public:
 
   librbd::ImageCtx *m_src_image_ctx;
   librbd::ImageCtx *m_dst_image_ctx;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
 
   void SetUp() override {
     TestMockFixture::SetUp();
index 7d61bb84716d48284d64361a129e367e3e48ce19..acd1a12693bf54e0a2145623f04541575eb07a86 100644 (file)
@@ -112,7 +112,7 @@ public:
 
   librbd::ImageCtx *m_src_image_ctx;
   librbd::ImageCtx *m_dst_image_ctx;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
 
   SnapMap m_snap_map;
   std::vector<librados::snap_t> m_src_snap_ids;
index 3eceb4daff20d2dee14400767a07ce041320c17b..f044f55e0c7a7b1e52c8d9e9c8bfb59ffb92138f 100644 (file)
@@ -97,7 +97,7 @@ public:
   typedef image::DetachParentRequest<MockTestImageCtx> MockDetachParentRequest;
 
   librbd::ImageCtx *m_image_ctx;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
 
   void SetUp() override {
     TestMockFixture::SetUp();
index e17782c189f30f89e6c14bbf0215b08f14fedd75..308b552ec0f56dbba06d08e4b6f9f8f6529c7265 100644 (file)
@@ -106,7 +106,7 @@ public:
 
   librbd::ImageCtx *m_src_image_ctx;
   librbd::ImageCtx *m_dst_image_ctx;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
 
   librbd::SnapSeqs m_snap_seqs;
 
index 571820edad894420f26b376430316f3aec141054..204328177cf055d5ff0b635cb783a9ac7209fe29 100644 (file)
@@ -76,7 +76,7 @@ public:
   typedef SnapshotCreateRequest<librbd::MockTestImageCtx> MockSnapshotCreateRequest;
 
   librbd::ImageCtx *m_image_ctx;
-  ContextWQ *m_work_queue;
+  asio::ContextWQ *m_work_queue;
 
   void SetUp() override {
     TestMockFixture::SetUp();
index 4c118ec35445d1a77256f4b7e8c768b9b00db701..1ba69bed6e8e3c56d90d391c30fcdae1b90aa656 100644 (file)
@@ -137,7 +137,7 @@ struct CreateRequest<MockTestImageCtx> {
                                cls::rbd::MirrorImageMode mode,
                                const std::string &non_primary_global_image_id,
                                const std::string &primary_mirror_uuid,
-                               ContextWQ *op_work_queue,
+                               asio::ContextWQ *op_work_queue,
                                Context *on_finish) {
     ceph_assert(s_instance != nullptr);
     s_instance->on_finish = on_finish;
@@ -162,7 +162,7 @@ struct RemoveRequest<MockTestImageCtx> {
                                const std::string &image_id,
                                bool force, bool from_trash_remove,
                                ProgressContext &prog_ctx,
-                               ContextWQ *op_work_queue,
+                               asio::ContextWQ *op_work_queue,
                                Context *on_finish) {
     ceph_assert(s_instance != nullptr);
     s_instance->on_finish = on_finish;
index 05f4a546fe3ea23c0cf3d922ba5704d91486e0e9..d6359ff32740e34aca081777c5a21c1a08da1d26 100644 (file)
@@ -14,6 +14,7 @@
 #include "librbd/image/PreRemoveRequest.h"
 #include "librbd/image/RemoveRequest.h"
 #include "librbd/journal/RemoveRequest.h"
+#include "librbd/journal/TypeTraits.h"
 #include "librbd/mirror/DisableRequest.h"
 #include "librbd/operation/TrimRequest.h"
 #include "gmock/gmock.h"
@@ -44,6 +45,12 @@ MockTestImageCtx* MockTestImageCtx::s_instance = nullptr;
 
 } // anonymous namespace
 
+template<>
+struct Journal<MockTestImageCtx> {
+  static void get_work_queue(CephContext*, MockContextWQ**) {
+  }
+};
+
 namespace image {
 
 template <>
@@ -97,6 +104,15 @@ PreRemoveRequest<MockTestImageCtx> *PreRemoveRequest<MockTestImageCtx>::s_instan
 
 } // namespace image
 
+namespace journal {
+
+template <>
+struct TypeTraits<MockTestImageCtx> {
+  typedef librbd::MockContextWQ ContextWQ;
+};
+
+} // namespace journal
+
 namespace operation {
 
 template <>
index bb07c77afade1edf1ada0ece539954968ef2d5e4..0d86f20e966fd468dce96020dd3fb5ea2d9bd447 100644 (file)
@@ -53,7 +53,7 @@ public:
 
   void expect_init_journaler(::journal::MockJournaler &mock_journaler, int r) {
     EXPECT_CALL(mock_journaler, init(_))
-                  .WillOnce(CompleteContext(r, static_cast<ContextWQ*>(NULL)));
+                  .WillOnce(CompleteContext(r, static_cast<asio::ContextWQ*>(NULL)));
   }
 
   void expect_get_journaler_cached_client(::journal::MockJournaler &mock_journaler,
index 345bcdcb1a702972d0b8168049d0b32b006b6f81..c4e7ed9dc32a24a49987ed0403786b9e13395976 100644 (file)
@@ -96,7 +96,7 @@ public:
 
     EXPECT_CALL(mock_journaler, allocate_tag(456, ContentsEqual(tag_data_bl),
                                              _, _))
-      .WillOnce(WithArg<3>(CompleteContext(r, static_cast<ContextWQ*>(NULL))));
+      .WillOnce(WithArg<3>(CompleteContext(r, static_cast<asio::ContextWQ*>(NULL))));
   }
 
   void expect_append_journaler(::journal::MockJournaler &mock_journaler) {
@@ -106,7 +106,7 @@ public:
 
   void expect_future_flush(::journal::MockFuture &mock_future, int r) {
     EXPECT_CALL(mock_future, flush(_))
-                  .WillOnce(CompleteContext(r, static_cast<ContextWQ*>(NULL)));
+                  .WillOnce(CompleteContext(r, static_cast<asio::ContextWQ*>(NULL)));
   }
 
   void expect_future_committed(::journal::MockJournaler &mock_journaler) {
@@ -116,7 +116,7 @@ public:
   void expect_flush_commit_position(::journal::MockJournaler &mock_journaler,
                                     int r) {
     EXPECT_CALL(mock_journaler, flush_commit_position(_))
-                  .WillOnce(CompleteContext(r, static_cast<ContextWQ*>(NULL)));
+                  .WillOnce(CompleteContext(r, static_cast<asio::ContextWQ*>(NULL)));
   }
 
   void expect_start_append(::journal::MockJournaler &mock_journaler) {
@@ -125,13 +125,13 @@ public:
 
   void expect_stop_append(::journal::MockJournaler &mock_journaler, int r) {
     EXPECT_CALL(mock_journaler, stop_append(_))
-                  .WillOnce(CompleteContext(r, static_cast<ContextWQ*>(NULL)));
+                  .WillOnce(CompleteContext(r, static_cast<asio::ContextWQ*>(NULL)));
   }
 
   void expect_shut_down_journaler(::journal::MockJournaler &mock_journaler,
                                   int r) {
     EXPECT_CALL(mock_journaler, shut_down(_))
-      .WillOnce(CompleteContext(r, static_cast<ContextWQ*>(NULL)));
+      .WillOnce(CompleteContext(r, static_cast<asio::ContextWQ*>(NULL)));
   }
 
 };
index 57c0583eb113953c603e92e48b23048f608a8c23..2c722558cd54242bd001f727bc5cf74768ee181c 100644 (file)
@@ -154,11 +154,14 @@ TEST_F(TestMockJournalResetRequest, Success) {
   MockCreateRequest mock_create_request;
   expect_create(mock_create_request, 0);
 
+  ContextWQ* context_wq;
+  Journal<>::get_work_queue(ictx->cct, &context_wq);
+
   C_SaferCond ctx;
   auto req = MockResetRequest::create(m_ioctx, "image id",
                                       Journal<>::IMAGE_CLIENT_ID,
                                       Journal<>::LOCAL_MIRROR_UUID,
-                                      ictx->op_work_queue , &ctx);
+                                      context_wq, &ctx);
   req->send();
   ASSERT_EQ(0, ctx.wait());
 }
@@ -175,11 +178,14 @@ TEST_F(TestMockJournalResetRequest, InitError) {
   expect_init_journaler(mock_journaler, -EINVAL);
   expect_shut_down_journaler(mock_journaler, 0);
 
+  ContextWQ* context_wq;
+  Journal<>::get_work_queue(ictx->cct, &context_wq);
+
   C_SaferCond ctx;
   auto req = MockResetRequest::create(m_ioctx, "image id",
                                       Journal<>::IMAGE_CLIENT_ID,
                                       Journal<>::LOCAL_MIRROR_UUID,
-                                      ictx->op_work_queue , &ctx);
+                                      context_wq, &ctx);
   req->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
@@ -197,11 +203,14 @@ TEST_F(TestMockJournalResetRequest, ShutDownError) {
   expect_get_metadata(mock_journaler);
   expect_shut_down_journaler(mock_journaler, -EINVAL);
 
+  ContextWQ* context_wq;
+  Journal<>::get_work_queue(ictx->cct, &context_wq);
+
   C_SaferCond ctx;
   auto req = MockResetRequest::create(m_ioctx, "image id",
                                       Journal<>::IMAGE_CLIENT_ID,
                                       Journal<>::LOCAL_MIRROR_UUID,
-                                      ictx->op_work_queue , &ctx);
+                                      context_wq, &ctx);
   req->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
@@ -222,11 +231,14 @@ TEST_F(TestMockJournalResetRequest, RemoveError) {
   MockRemoveRequest mock_remove_request;
   expect_remove(mock_remove_request, -EINVAL);
 
+  ContextWQ* context_wq;
+  Journal<>::get_work_queue(ictx->cct, &context_wq);
+
   C_SaferCond ctx;
   auto req = MockResetRequest::create(m_ioctx, "image id",
                                       Journal<>::IMAGE_CLIENT_ID,
                                       Journal<>::LOCAL_MIRROR_UUID,
-                                      ictx->op_work_queue , &ctx);
+                                      context_wq, &ctx);
   req->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
@@ -250,11 +262,14 @@ TEST_F(TestMockJournalResetRequest, CreateError) {
   MockCreateRequest mock_create_request;
   expect_create(mock_create_request, -EINVAL);
 
+  ContextWQ* context_wq;
+  Journal<>::get_work_queue(ictx->cct, &context_wq);
+
   C_SaferCond ctx;
   auto req = MockResetRequest::create(m_ioctx, "image id",
                                       Journal<>::IMAGE_CLIENT_ID,
                                       Journal<>::LOCAL_MIRROR_UUID,
-                                      ictx->op_work_queue , &ctx);
+                                      context_wq, &ctx);
   req->send();
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
index 5218fa96d3477fcb4591ee18cf23d22795231126..279a8182631faab146372a846d57d85ead53adb2 100644 (file)
@@ -28,7 +28,8 @@ template<>
 struct BreakRequest<librbd::MockImageCtx> {
   Context *on_finish = nullptr;
   static BreakRequest *s_instance;
-  static BreakRequest* create(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  static BreakRequest* create(librados::IoCtx& ioctx,
+                              asio::ContextWQ *work_queue,
                               const std::string& oid, const Locker &locker,
                               bool exclusive, bool blacklist_locker,
                               uint32_t blacklist_expire_seconds,
index 85298eeb3d0256a1f0b65c73ae5e31b1ce1f723a..171ac41a71a8f88b38c01a7f2feb4b4ea3fceaef 100644 (file)
@@ -7,12 +7,14 @@
 #include "test/librbd/mock/MockJournalPolicy.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/internal.h"
+#include "librbd/Journal.h"
 #include "librbd/image/SetFlagsRequest.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/mirror/DisableRequest.h"
 #include "librbd/journal/RemoveRequest.h"
 #include "librbd/journal/StandardPolicy.h"
 #include "librbd/journal/Types.h"
+#include "librbd/journal/TypeTraits.h"
 #include "librbd/object_map/RemoveRequest.h"
 #include "librbd/operation/DisableFeaturesRequest.h"
 #include "gmock/gmock.h"
@@ -29,6 +31,12 @@ struct MockOperationImageCtx : public MockImageCtx {
 
 } // anonymous namespace
 
+template<>
+struct Journal<MockOperationImageCtx> {
+  static void get_work_queue(CephContext*, MockContextWQ**) {
+  }
+};
+
 namespace image {
 
 template<>
@@ -88,6 +96,11 @@ public:
   }
 };
 
+template <>
+struct TypeTraits<MockOperationImageCtx> {
+  typedef librbd::MockContextWQ ContextWQ;
+};
+
 } // namespace journal
 
 namespace mirror {
index 1e99489aaafdf27991d05ef8457eaf2b3582cf8c..b7bf7d1781d3bedbab91857022598dfda23da666 100644 (file)
@@ -7,11 +7,13 @@
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/Operations.h"
 #include "librbd/internal.h"
+#include "librbd/Journal.h"
 #include "librbd/image/SetFlagsRequest.h"
 #include "librbd/io/AioCompletion.h"
 #include "librbd/mirror/EnableRequest.h"
 #include "librbd/journal/CreateRequest.h"
 #include "librbd/journal/Types.h"
+#include "librbd/journal/TypeTraits.h"
 #include "librbd/object_map/CreateRequest.h"
 #include "librbd/operation/EnableFeaturesRequest.h"
 #include "gmock/gmock.h"
@@ -29,6 +31,12 @@ struct MockOperationImageCtx : public MockImageCtx {
 
 } // anonymous namespace
 
+template<>
+struct Journal<MockOperationImageCtx> {
+  static void get_work_queue(CephContext*, MockContextWQ**) {
+  }
+};
+
 namespace image {
 
 template<>
@@ -84,6 +92,11 @@ public:
 
 CreateRequest<MockOperationImageCtx> *CreateRequest<MockOperationImageCtx>::s_instance = nullptr;
 
+template <>
+struct TypeTraits<MockOperationImageCtx> {
+  typedef librbd::MockContextWQ ContextWQ;
+};
+
 } // namespace journal
 
 namespace mirror {
index c6ec8d6ace892cad23c0663548338d1dade15af1..93f37909feee963e8adc26a270c9367a23a9948e 100644 (file)
@@ -100,7 +100,8 @@ public:
                                      librados::snap_t src_snap_id_start,
                                      librados::snap_t src_snap_id_end,
                                      librados::snap_t dst_snap_id_start,
-                                     bool flatten, ContextWQ *work_queue,
+                                     bool flatten,
+                                     librbd::asio::ContextWQ *work_queue,
                                      SnapSeqs *snap_seqs, Context *on_finish) {
     ceph_assert(s_instance != nullptr);
     s_instance->on_finish = on_finish;
@@ -149,7 +150,7 @@ public:
 
   librbd::ImageCtx *m_src_image_ctx;
   librbd::ImageCtx *m_dst_image_ctx;
-  ContextWQ *m_work_queue;
+  librbd::asio::ContextWQ *m_work_queue;
 
   void SetUp() override {
     TestMockFixture::SetUp();
index 19b28722ccae205b82abd2c37a472cd851a3ff73..34ae8c5a6ef44c488a2c730b41c022658c051b31 100644 (file)
@@ -22,7 +22,7 @@ namespace librbd {
 namespace {
 
 struct MockExclusiveLockImageCtx : public MockImageCtx {
-  ContextWQ *op_work_queue;
+  asio::ContextWQ *op_work_queue;
 
   MockExclusiveLockImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {
     op_work_queue = image_ctx.op_work_queue;
@@ -40,7 +40,7 @@ struct Traits<MockExclusiveLockImageCtx> {
 
 template <>
 struct ManagedLock<MockExclusiveLockImageCtx> {
-  ManagedLock(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  ManagedLock(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
               const std::string& oid, librbd::MockImageWatcher *watcher,
               managed_lock::Mode  mode, bool blacklist_on_break_lock,
               uint32_t blacklist_expire_seconds)
@@ -341,7 +341,7 @@ public:
 
   void expect_shut_down(MockManagedLock *managed_lock) {
     EXPECT_CALL(*managed_lock, shut_down(_))
-      .WillOnce(CompleteContext(0, static_cast<ContextWQ*>(nullptr)));
+      .WillOnce(CompleteContext(0, static_cast<asio::ContextWQ*>(nullptr)));
   }
 
   void expect_accept_blocked_request(
index bab068be063cc47a732587d0c2d8cbea9dd5a47c..b57c66e8907cdfc43f003f46248cc5c3a814a4d0 100644 (file)
@@ -9,6 +9,7 @@
 #include "test/librbd/mock/io/MockObjectDispatch.h"
 #include "common/Cond.h"
 #include "common/ceph_mutex.h"
+#include "common/WorkQueue.h"
 #include "cls/journal/cls_journal_types.h"
 #include "journal/Journaler.h"
 #include "librbd/Journal.h"
@@ -297,7 +298,7 @@ public:
   void expect_shut_down_journaler(::journal::MockJournaler &mock_journaler) {
     EXPECT_CALL(mock_journaler, remove_listener(_));
     EXPECT_CALL(mock_journaler, shut_down(_))
-                  .WillOnce(CompleteContext(0, static_cast<ContextWQ*>(NULL)));
+                  .WillOnce(CompleteContext(0, static_cast<asio::ContextWQ*>(NULL)));
   }
 
   void expect_register_dispatch(MockImageCtx& mock_image_ctx,
@@ -353,7 +354,7 @@ public:
 
   void expect_stop_replay(::journal::MockJournaler &mock_journaler) {
     EXPECT_CALL(mock_journaler, stop_replay(_))
-                  .WillOnce(CompleteContext(0, static_cast<ContextWQ*>(NULL)));
+                  .WillOnce(CompleteContext(0, static_cast<asio::ContextWQ*>(NULL)));
   }
 
   void expect_shut_down_replay(MockJournalImageCtx &mock_image_ctx,
@@ -389,7 +390,7 @@ public:
     EXPECT_CALL(mock_journal_replay, decode(_, _))
                   .WillOnce(Return(0));
     EXPECT_CALL(mock_journal_replay, process(_, _, _))
-                  .WillOnce(DoAll(WithArg<1>(CompleteContext(0, static_cast<ContextWQ*>(NULL))),
+                  .WillOnce(DoAll(WithArg<1>(CompleteContext(0, static_cast<asio::ContextWQ*>(NULL))),
                                   WithArg<2>(Invoke(this, &TestMockJournal::save_commit_context))));
   }
 
@@ -408,7 +409,7 @@ public:
 
   void expect_stop_append(::journal::MockJournaler &mock_journaler, int r) {
     EXPECT_CALL(mock_journaler, stop_append(_))
-                  .WillOnce(CompleteContext(r, static_cast<ContextWQ*>(NULL)));
+                  .WillOnce(CompleteContext(r, static_cast<asio::ContextWQ*>(NULL)));
   }
 
   void expect_committed(::journal::MockJournaler &mock_journaler,
@@ -438,7 +439,7 @@ public:
 
   void expect_flush_commit_position(::journal::MockJournaler &mock_journaler) {
     EXPECT_CALL(mock_journaler, flush_commit_position(_))
-                  .WillOnce(CompleteContext(0, static_cast<ContextWQ*>(NULL)));
+                  .WillOnce(CompleteContext(0, static_cast<asio::ContextWQ*>(NULL)));
   }
 
   int when_open(MockJournal *mock_journal) {
index 921d9f50442bb0a14d06a2d85c7c8e156b691330..bfad742240565a77dd9cc24a4f7689d927f730fe 100644 (file)
@@ -27,7 +27,7 @@ struct Traits<MockManagedLockImageCtx> {
 }
 
 struct MockMockManagedLock : public ManagedLock<MockManagedLockImageCtx> {
-  MockMockManagedLock(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  MockMockManagedLock(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
                  const std::string& oid, librbd::MockImageWatcher *watcher,
                  managed_lock::Mode  mode, bool blacklist_on_break_lock, 
                  uint32_t blacklist_expire_seconds)
@@ -50,7 +50,7 @@ struct BaseRequest {
   Context *on_finish = nullptr;
 
   static T* create(librados::IoCtx& ioctx, MockImageWatcher *watcher,
-                   ContextWQ *work_queue, const std::string& oid,
+                   asio::ContextWQ *work_queue, const std::string& oid,
                    const std::string& cookie, Context *on_finish) {
     ceph_assert(!s_requests.empty());
     T* req = s_requests.front();
@@ -71,7 +71,8 @@ template <>
 struct AcquireRequest<MockManagedLockImageCtx> : public BaseRequest<AcquireRequest<MockManagedLockImageCtx> > {
   static AcquireRequest* create(librados::IoCtx& ioctx,
                                MockImageWatcher *watcher,
-                                ContextWQ *work_queue, const std::string& oid,
+                                asio::ContextWQ *work_queue,
+                                const std::string& oid,
                                 const std::string& cookie,
                                 bool exclusive, bool blacklist_on_break_lock,
                                 uint32_t blacklist_expire_seconds,
@@ -97,7 +98,8 @@ struct ReacquireRequest<MockManagedLockImageCtx> : public BaseRequest<ReacquireR
 template <>
 struct ReleaseRequest<MockManagedLockImageCtx> : public BaseRequest<ReleaseRequest<MockManagedLockImageCtx> > {
   static ReleaseRequest* create(librados::IoCtx& ioctx, MockImageWatcher *watcher,
-                                ContextWQ *work_queue, const std::string& oid,
+                                asio::ContextWQ *work_queue,
+                                const std::string& oid,
                                 const std::string& cookie, Context *on_finish) {
     return BaseRequest::create(ioctx, watcher, work_queue, oid, cookie,
                                on_finish);
@@ -120,7 +122,8 @@ struct GetLockerRequest<MockManagedLockImageCtx> {
 
 template <>
 struct BreakRequest<MockManagedLockImageCtx> {
-  static BreakRequest* create(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  static BreakRequest* create(librados::IoCtx& ioctx,
+                              asio::ContextWQ *work_queue,
                               const std::string& oid, const Locker &locker,
                               bool exclusive, bool blacklist_locker,
                               uint32_t blacklist_expire_seconds,
@@ -182,21 +185,21 @@ public:
   }
 
   void expect_acquire_lock(MockImageWatcher &watcher,
-                           ContextWQ *work_queue,
+                           asio::ContextWQ *work_queue,
                            MockAcquireRequest &acquire_request, int r) {
     expect_get_watch_handle(watcher);
     EXPECT_CALL(acquire_request, send())
                   .WillOnce(QueueRequest(&acquire_request, r, work_queue));
   }
 
-  void expect_release_lock(ContextWQ *work_queue,
+  void expect_release_lock(asio::ContextWQ *work_queue,
                            MockReleaseRequest &release_request, int r) {
     EXPECT_CALL(release_request, send())
                   .WillOnce(QueueRequest(&release_request, r, work_queue));
   }
 
   void expect_reacquire_lock(MockImageWatcher& watcher,
-                             ContextWQ *work_queue,
+                             asio::ContextWQ *work_queue,
                              MockReacquireRequest &mock_reacquire_request,
                              int r) {
     EXPECT_CALL(mock_reacquire_request, send())
@@ -205,7 +208,7 @@ public:
 
   void expect_flush_notifies(MockImageWatcher *mock_watcher) {
     EXPECT_CALL(*mock_watcher, flush(_))
-                  .WillOnce(CompleteContext(0, (ContextWQ *)nullptr));
+                  .WillOnce(CompleteContext(0, (asio::ContextWQ *)nullptr));
   }
 
   void expect_post_reacquired_lock_handler(MockImageWatcher& watcher, 
index b36ec3e31f2ae8b6c0c77da93d0da2a601850d2f..23a0e2aa9e4e22daa7b833a4e6bb1015e27b7a50 100644 (file)
@@ -22,7 +22,7 @@ namespace {
 struct MockWatcher : public Watcher {
   std::string oid;
 
-  MockWatcher(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  MockWatcher(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
               const std::string& oid)
     : Watcher(ioctx, work_queue, oid) {
   }
index 408c1b7fd1206294f1105a58dc4ab49b18caca89..4e96d955f756e9fcf0afd043874ca90194851bdf 100644 (file)
@@ -7,7 +7,7 @@
 #include "test/librbd/test_fixture.h"
 #include "test/librbd/mock/MockImageCtx.h"
 #include "test/librados_test_stub/LibradosTestStub.h"
-#include "common/WorkQueue.h"
+#include "librbd/asio/ContextWQ.h"
 #include <boost/shared_ptr.hpp>
 #include <gmock/gmock.h>
 
@@ -26,7 +26,8 @@ ACTION_P(CopyInBufferlist, str) {
 }
 
 ACTION_P2(CompleteContext, r, wq) {
-  ContextWQ *context_wq = reinterpret_cast<ContextWQ *>(wq);
+  librbd::asio::ContextWQ *context_wq = reinterpret_cast<
+    librbd::asio::ContextWQ *>(wq);
   if (context_wq != NULL) {
     context_wq->queue(arg0, r);
   } else {