]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: swapped ThreadPool/ContextWQ for AsioEngine 35557/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 12 Jun 2020 02:07:15 +0000 (22:07 -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 remains the only
remaining use of dedicated ThreadPools in rbd-mirror.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
54 files changed:
src/test/rbd_mirror/image_deleter/test_mock_TrashMoveRequest.cc
src/test/rbd_mirror/image_deleter/test_mock_TrashRemoveRequest.cc
src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_PrepareLocalImageRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_PrepareRemoteImageRequest.cc
src/test/rbd_mirror/test_ImageSync.cc
src/test/rbd_mirror/test_mock_ImageSync.cc
src/test/rbd_mirror/test_mock_InstanceWatcher.cc
src/test/rbd_mirror/test_mock_LeaderWatcher.cc
src/test/rbd_mirror/test_mock_NamespaceReplayer.cc
src/test/rbd_mirror/test_mock_fixture.h
src/tools/rbd_mirror/ImageDeleter.cc
src/tools/rbd_mirror/ImageDeleter.h
src/tools/rbd_mirror/ImageMap.cc
src/tools/rbd_mirror/ImageReplayer.cc
src/tools/rbd_mirror/ImageSync.cc
src/tools/rbd_mirror/ImageSync.h
src/tools/rbd_mirror/InstanceReplayer.cc
src/tools/rbd_mirror/InstanceWatcher.cc
src/tools/rbd_mirror/InstanceWatcher.h
src/tools/rbd_mirror/Instances.cc
src/tools/rbd_mirror/LeaderWatcher.cc
src/tools/rbd_mirror/LeaderWatcher.h
src/tools/rbd_mirror/MirrorStatusUpdater.cc
src/tools/rbd_mirror/MirrorStatusWatcher.cc
src/tools/rbd_mirror/MirrorStatusWatcher.h
src/tools/rbd_mirror/NamespaceReplayer.cc
src/tools/rbd_mirror/NamespaceReplayer.h
src/tools/rbd_mirror/PoolReplayer.h
src/tools/rbd_mirror/PoolWatcher.cc
src/tools/rbd_mirror/RemotePoolPoller.cc
src/tools/rbd_mirror/Threads.cc
src/tools/rbd_mirror/Threads.h
src/tools/rbd_mirror/image_deleter/TrashMoveRequest.cc
src/tools/rbd_mirror/image_deleter/TrashMoveRequest.h
src/tools/rbd_mirror/image_deleter/TrashRemoveRequest.cc
src/tools/rbd_mirror/image_deleter/TrashRemoveRequest.h
src/tools/rbd_mirror/image_deleter/TrashWatcher.cc
src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc
src/tools/rbd_mirror/image_replayer/BootstrapRequest.h
src/tools/rbd_mirror/image_replayer/CloseImageRequest.cc
src/tools/rbd_mirror/image_replayer/CreateImageRequest.cc
src/tools/rbd_mirror/image_replayer/CreateImageRequest.h
src/tools/rbd_mirror/image_replayer/OpenLocalImageRequest.cc
src/tools/rbd_mirror/image_replayer/OpenLocalImageRequest.h
src/tools/rbd_mirror/image_replayer/PrepareLocalImageRequest.h
src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc
src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.h
src/tools/rbd_mirror/image_replayer/journal/EventPreprocessor.cc
src/tools/rbd_mirror/image_replayer/journal/EventPreprocessor.h
src/tools/rbd_mirror/image_replayer/journal/Replayer.cc
src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc

index 2630915115d0366fe9a9bdce59c0595516b44a98..ae481dce4e2948b08829af793f550160d0ae5a65 100644 (file)
@@ -74,7 +74,8 @@ struct ResetRequest<MockTestImageCtx> {
                               const std::string &image_id,
                               const std::string &client_id,
                               const std::string &mirror_uuid,
-                              ContextWQ *op_work_queue, Context *on_finish) {
+                              ContextWQ *op_work_queue,
+                              Context *on_finish) {
     ceph_assert(s_instance != nullptr);
     EXPECT_EQ(librbd::Journal<>::LOCAL_MIRROR_UUID, mirror_uuid);
     s_instance->on_finish = on_finish;
@@ -103,7 +104,7 @@ struct GetInfoRequest<librbd::MockTestImageCtx> {
   Context *on_finish = nullptr;
 
   static GetInfoRequest* create(librados::IoCtx& io_ctx,
-                                ContextWQ* context_wq,
+                                librbd::asio::ContextWQ* context_wq,
                                 const std::string& image_id,
                                 cls::rbd::MirrorImage *mirror_image,
                                 PromotionState *promotion_state,
index b9c5b1a2d74339b6b6f841b788ba3ac4f155184d..43057cce0489cb1852ede16c2c3ed9a263fce37f 100644 (file)
@@ -52,7 +52,7 @@ struct RemoveRequest<librbd::MockTestImageCtx> {
 
   static RemoveRequest *create(librados::IoCtx &io_ctx,
                                const std::string &image_id,
-                               ContextWQ *work_queue,
+                               librbd::asio::ContextWQ *work_queue,
                                bool force,
                                librbd::ProgressContext &progress_ctx,
                                Context *on_finish) {
index 18304f67dd7dc4c4e72c65761c13c9d690061c7d..3277f77f87aa20e3a2ba1db942bcad644f79fefa 100644 (file)
@@ -48,7 +48,7 @@ template <>
 struct Threads<librbd::MockTestImageCtx> {
   ceph::mutex &timer_lock;
   SafeTimer *timer;
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
   Threads(Threads<librbd::ImageCtx> *threads)
     : timer_lock(threads->timer_lock), timer(threads->timer),
index 8175680ab6c86ec86865c896b4c9c4bd8cf23be3..53a69a84eefafdf4cca5b377d06c9c777338f61d 100644 (file)
@@ -39,7 +39,7 @@ template <>
 struct Threads<librbd::MockTestImageCtx> {
   ceph::mutex &timer_lock;
   SafeTimer *timer;
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
   Threads(Threads<librbd::ImageCtx> *threads)
     : timer_lock(threads->timer_lock), timer(threads->timer),
@@ -127,7 +127,7 @@ struct OpenLocalImageRequest<librbd::MockTestImageCtx> {
   static OpenLocalImageRequest* create(librados::IoCtx &local_io_ctx,
                                        librbd::MockTestImageCtx **local_image_ctx,
                                        const std::string &local_image_id,
-                                       ContextWQ *work_queue,
+                                       librbd::asio::ContextWQ *work_queue,
                                        Context *on_finish) {
     ceph_assert(s_instance != nullptr);
     s_instance->image_ctx = local_image_ctx;
@@ -160,7 +160,7 @@ struct PrepareLocalImageRequest<librbd::MockTestImageCtx> {
                                           const std::string &global_image_id,
                                           std::string *local_image_name,
                                           StateBuilder<librbd::MockTestImageCtx>** state_builder,
-                                          ContextWQ *work_queue,
+                                          librbd::asio::ContextWQ *work_queue,
                                           Context *on_finish) {
     ceph_assert(s_instance != nullptr);
     s_instance->local_image_name = local_image_name;
index ab952269d3d222a9b8d0f38885a82f6f76361328..2e10f28d6d8aa860d0d9bc3766f475d08f0f9687 100644 (file)
@@ -118,7 +118,7 @@ template <>
 struct Threads<librbd::MockTestImageCtx> {
   ceph::mutex &timer_lock;
   SafeTimer *timer;
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
   Threads(Threads<librbd::ImageCtx> *threads)
     : timer_lock(threads->timer_lock), timer(threads->timer),
index d2cb1afb67735881027293563e597bd2b6f6bdc4..a53f01fd2c98e5f46b5da8c592e369c2510745b6 100644 (file)
@@ -38,7 +38,7 @@ struct GetInfoRequest<librbd::MockTestImageCtx> {
   Context *on_finish = nullptr;
 
   static GetInfoRequest* create(librados::IoCtx& io_ctx,
-                                ContextWQ* context_wq,
+                                librbd::asio::ContextWQ* context_wq,
                                 const std::string& image_id,
                                 cls::rbd::MirrorImage *mirror_image,
                                 PromotionState *promotion_state,
index ae03f708c085f90dd4cd8a9b7895d904bb6bd655..e49b40821821a5190fdcadbf304dc091dd553c58 100644 (file)
@@ -47,7 +47,7 @@ struct GetInfoRequest<librbd::MockTestImageCtx> {
   Context *on_finish = nullptr;
 
   static GetInfoRequest* create(librados::IoCtx& io_ctx,
-                                ContextWQ* context_wq,
+                                librbd::asio::ContextWQ* context_wq,
                                 const std::string& image_id,
                                 cls::rbd::MirrorImage *mirror_image,
                                 PromotionState *promotion_state,
@@ -84,7 +84,7 @@ template <>
 struct Threads<librbd::MockTestImageCtx> {
   ceph::mutex &timer_lock;
   SafeTimer *timer;
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
   Threads(Threads<librbd::ImageCtx> *threads)
     : timer_lock(threads->timer_lock), timer(threads->timer),
index 7415fff2fa9a549ce1cfaa7a81a7238bb9bbdef4..6b9b2f7d4071e503cc14881cec8c5b8424d65f80 100644 (file)
@@ -11,6 +11,7 @@
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/internal.h"
+#include "librbd/Journal.h"
 #include "librbd/Operations.h"
 #include "librbd/api/Io.h"
 #include "librbd/io/AioCompletion.h"
@@ -82,8 +83,11 @@ public:
         m_local_io_ctx, m_threads->work_queue, nullptr, m_image_sync_throttler);
     m_instance_watcher->handle_acquire_leader();
 
+    ContextWQ* context_wq;
+    librbd::Journal<>::get_work_queue(cct, &context_wq);
+
     m_remote_journaler = new ::journal::Journaler(
-      m_threads->work_queue, m_threads->timer, &m_threads->timer_lock,
+      context_wq, m_threads->timer, &m_threads->timer_lock,
       m_remote_io_ctx, m_remote_image_ctx->id, "mirror-uuid", {}, nullptr);
 
     m_client_meta = {"image-id"};
index 5b424718cb7384ef363d401b1c4b0667dcf0f7ee..bd6a2907830e60072f12e1b801b25434f83ed2bf 100644 (file)
@@ -36,8 +36,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,
       const librbd::deep_copy::ObjectNumber &object_number,
-      ContextWQ *work_queue, SnapSeqs *snap_seqs, deep_copy::Handler *handler,
-      Context *on_finish) {
+      librbd::asio::ContextWQ *work_queue, SnapSeqs *snap_seqs,
+      deep_copy::Handler *handler, Context *on_finish) {
     ceph_assert(s_instance != nullptr);
     s_instance->on_finish = on_finish;
     return s_instance;
@@ -71,7 +71,7 @@ template <>
 struct Threads<librbd::MockTestImageCtx> {
   ceph::mutex &timer_lock;
   SafeTimer *timer;
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
   Threads(Threads<librbd::ImageCtx> *threads)
     : timer_lock(threads->timer_lock), timer(threads->timer),
index 8e9b79e8d566ba23f1b37e2d3ce31741183307c2..7b06424b702b24d3e2a6bef0f6cc45d61a7995cf 100644 (file)
@@ -28,7 +28,8 @@ template <>
 struct ManagedLock<MockTestImageCtx> {
   static ManagedLock* s_instance;
 
-  static ManagedLock *create(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  static ManagedLock *create(librados::IoCtx& ioctx,
+                             librbd::asio::ContextWQ *work_queue,
                              const std::string& oid, librbd::Watcher *watcher,
                              managed_lock::Mode  mode,
                              bool blacklist_on_break_lock,
@@ -65,7 +66,7 @@ template <>
 struct Threads<librbd::MockTestImageCtx> {
   ceph::mutex &timer_lock;
   SafeTimer *timer;
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
   Threads(Threads<librbd::ImageCtx> *threads)
     : timer_lock(threads->timer_lock), timer(threads->timer),
index ec64e668c159d7e94220d7464d73d534b03b3eb9..9365a9b431447a5e246d15c8149fd69e03f5ee4c 100644 (file)
@@ -60,7 +60,7 @@ MockManagedLock *MockManagedLock::s_instance = nullptr;
 
 template <>
 struct ManagedLock<MockTestImageCtx> {
-  ManagedLock(librados::IoCtx& ioctx, ContextWQ *work_queue,
+  ManagedLock(librados::IoCtx& ioctx, librbd::asio::ContextWQ *work_queue,
               const std::string& oid, librbd::Watcher *watcher,
               managed_lock::Mode  mode, bool blacklist_on_break_lock,
               uint32_t blacklist_expire_seconds)
@@ -72,7 +72,7 @@ struct ManagedLock<MockTestImageCtx> {
     MockManagedLock::get_instance().destroy();
   }
 
-  ContextWQ *m_work_queue;
+  librbd::asio::ContextWQ *m_work_queue;
 
   mutable ceph::mutex m_lock = ceph::make_mutex("ManagedLock::m_lock");
 
@@ -184,7 +184,7 @@ template <>
 struct Threads<librbd::MockTestImageCtx> {
   ceph::mutex &timer_lock;
   SafeTimer *timer;
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
   Threads(Threads<librbd::ImageCtx> *threads)
     : timer_lock(threads->timer_lock), timer(threads->timer),
index da6436cc18de74c29d2fe29d85c333679bf17f34..0470fb5efd8e2814a55098541d537696de02b600 100644 (file)
@@ -132,7 +132,7 @@ struct InstanceWatcher<librbd::MockTestImageCtx> {
   static InstanceWatcher* s_instance;
 
   static InstanceWatcher* create(
-      librados::IoCtx &ioctx, ContextWQ* work_queue,
+      librados::IoCtx &ioctx, librbd::asio::ContextWQ* work_queue,
       InstanceReplayer<librbd::MockTestImageCtx>* instance_replayer,
       Throttler<librbd::MockTestImageCtx> *image_sync_throttler) {
     ceph_assert(s_instance != nullptr);
@@ -249,7 +249,7 @@ template <>
 struct Threads<librbd::MockTestImageCtx> {
   ceph::mutex &timer_lock;
   SafeTimer *timer;
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
   Threads(Threads<librbd::ImageCtx> *threads)
     : timer_lock(threads->timer_lock), timer(threads->timer),
index 1f7dfb0319e7dab814f1099f774fff0261252362..16b6dc6b8b1d978c705998b65d0b3b4c74679752 100644 (file)
@@ -7,6 +7,7 @@
 #include "test/rbd_mirror/test_fixture.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>
 #include "include/ceph_assert.h"
@@ -31,7 +32,7 @@ ACTION_P(CompleteContext, r) {
 }
 
 ACTION_P2(CompleteContext, wq, r) {
-  ContextWQ *context_wq = reinterpret_cast<ContextWQ *>(wq);
+  auto context_wq = reinterpret_cast<librbd::asio::ContextWQ *>(wq);
   context_wq->queue(arg0, r);
 }
 
index 0f3f51622976566e0916697457b80c6811c2bd79..b07b4333ac6cffebd56830463cfe8ccf19089555 100644 (file)
 #include "common/debug.h"
 #include "common/errno.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "global/global_context.h"
 #include "librbd/internal.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/Operations.h"
+#include "librbd/asio/ContextWQ.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "cls/rbd/cls_rbd_types.h"
 #include "librbd/Utils.h"
@@ -141,7 +141,8 @@ template <typename I>
 void ImageDeleter<I>::trash_move(librados::IoCtx& local_io_ctx,
                                  const std::string& global_image_id,
                                  bool resync,
-                                 ContextWQ* work_queue, Context* on_finish) {
+                                 librbd::asio::ContextWQ* work_queue,
+                                 Context* on_finish) {
   dout(10) << "global_image_id=" << global_image_id << ", "
            << "resync=" << resync << dendl;
 
index 65cb3a83296bd13462c9da913148de98684656a0..d9f4e14a7e2ccb7eedf0d5cf7a852e830eb31690 100644 (file)
 
 class AdminSocketHook;
 class Context;
-class ContextWQ;
 class SafeTimer;
-namespace librbd { struct ImageCtx; }
+namespace librbd {
+struct ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -66,7 +68,8 @@ public:
 
   static void trash_move(librados::IoCtx& local_io_ctx,
                          const std::string& global_image_id, bool resync,
-                         ContextWQ* work_queue, Context* on_finish);
+                         librbd::asio::ContextWQ* work_queue,
+                         Context* on_finish);
 
   void init(Context* on_finish);
   void shut_down(Context* on_finish);
index 6a308019f693423e976c5863ae9167b6df453a6d..4493e073b98bc9a0827d369fa585b48184866a84 100644 (file)
@@ -4,9 +4,9 @@
 #include "common/debug.h"
 #include "common/errno.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "tools/rbd_mirror/Threads.h"
 
 #include "ImageMap.h"
index 2d57a98d2f9c615334c21292850c7b5bc161c765..9289510e11d9e7df1042b312079437c36c0ea92a 100644 (file)
@@ -9,7 +9,6 @@
 #include "include/stringify.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "global/global_context.h"
 #include "journal/Journaler.h"
 #include "librbd/ExclusiveLock.h"
@@ -18,6 +17,7 @@
 #include "librbd/Journal.h"
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "ImageDeleter.h"
 #include "ImageReplayer.h"
 #include "MirrorStatusUpdater.h"
index a56723be2edad69cf0e04f5a36042ac913e58bc7..43d0c666338657b7155cde475058aa6c808c66b8 100644 (file)
@@ -12,6 +12,7 @@
 #include "librbd/ImageState.h"
 #include "librbd/Utils.h"
 #include "librbd/internal.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/deep_copy/Handler.h"
 #include "tools/rbd_mirror/Threads.h"
 #include "tools/rbd_mirror/image_sync/SyncPointCreateRequest.h"
index b1d88b857e3bc0370822db18291f98d2268cec98..b3389ce18fec89d6d28e0d34e5ae64774116825b 100644 (file)
@@ -12,7 +12,6 @@
 #include "tools/rbd_mirror/image_sync/Types.h"
 
 class Context;
-class ContextWQ;
 namespace journal { class Journaler; }
 namespace librbd { template <typename> class DeepCopyRequest; }
 
index 4ef838fa43ebbfcd1671d07231b01b153c7d035a..2def7ba03c76fccc5993717d36d5a668132fdbf5 100644 (file)
@@ -6,8 +6,8 @@
 #include "common/Timer.h"
 #include "common/debug.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "ImageReplayer.h"
 #include "InstanceReplayer.h"
 #include "ServiceDaemon.h"
index 58253c8c52acf3e2fb198de13e6effd94fe7a03b..2ebce31e82e44044e039b944c6c4b3386c4e7ce7 100644 (file)
@@ -8,6 +8,7 @@
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/ManagedLock.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "InstanceReplayer.h"
 #include "Throttler.h"
 #include "common/Cond.h"
@@ -57,7 +58,8 @@ struct C_RemoveInstanceRequest : public Context {
   InstanceWatcher<I> instance_watcher;
   Context *on_finish;
 
-  C_RemoveInstanceRequest(librados::IoCtx &io_ctx, ContextWQ *work_queue,
+  C_RemoveInstanceRequest(librados::IoCtx &io_ctx,
+                          librbd::asio::ContextWQ *work_queue,
                           const std::string &instance_id, Context *on_finish)
     : instance_watcher(io_ctx, work_queue, nullptr, nullptr, instance_id),
       on_finish(on_finish) {
@@ -301,7 +303,7 @@ void InstanceWatcher<I>::get_instances(librados::IoCtx &io_ctx,
 
 template <typename I>
 void InstanceWatcher<I>::remove_instance(librados::IoCtx &io_ctx,
-                                         ContextWQ *work_queue,
+                                         librbd::asio::ContextWQ *work_queue,
                                          const std::string &instance_id,
                                          Context *on_finish) {
   auto req = new C_RemoveInstanceRequest<I>(io_ctx, work_queue, instance_id,
@@ -311,7 +313,7 @@ void InstanceWatcher<I>::remove_instance(librados::IoCtx &io_ctx,
 
 template <typename I>
 InstanceWatcher<I> *InstanceWatcher<I>::create(
-    librados::IoCtx &io_ctx, ContextWQ *work_queue,
+    librados::IoCtx &io_ctx, librbd::asio::ContextWQ *work_queue,
     InstanceReplayer<I> *instance_replayer,
     Throttler<I> *image_sync_throttler) {
   return new InstanceWatcher<I>(io_ctx, work_queue, instance_replayer,
@@ -321,7 +323,7 @@ InstanceWatcher<I> *InstanceWatcher<I>::create(
 
 template <typename I>
 InstanceWatcher<I>::InstanceWatcher(librados::IoCtx &io_ctx,
-                                    ContextWQ *work_queue,
+                                    librbd::asio::ContextWQ *work_queue,
                                     InstanceReplayer<I> *instance_replayer,
                                     Throttler<I> *image_sync_throttler,
                                     const std::string &instance_id)
index bc459f3e4c0682c4823d1358b794d15222e6be31..c6d983c7e80dc4c0043e7c51e2aa2c6102e555b4 100644 (file)
@@ -19,8 +19,9 @@ namespace librbd {
 
 class ImageCtx;
 template <typename> class ManagedLock;
+namespace asio { struct ContextWQ; }
 
-}
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -37,19 +38,19 @@ public:
                             std::vector<std::string> *instance_ids,
                             Context *on_finish);
   static void remove_instance(librados::IoCtx &io_ctx,
-                              ContextWQ *work_queue,
+                              librbd::asio::ContextWQ *work_queue,
                               const std::string &instance_id,
                               Context *on_finish);
 
   static InstanceWatcher *create(
-    librados::IoCtx &io_ctx, ContextWQ *work_queue,
+    librados::IoCtx &io_ctx, librbd::asio::ContextWQ *work_queue,
     InstanceReplayer<ImageCtxT> *instance_replayer,
     Throttler<ImageCtxT> *image_sync_throttler);
   void destroy() {
     delete this;
   }
 
-  InstanceWatcher(librados::IoCtx &io_ctx, ContextWQ *work_queue,
+  InstanceWatcher(librados::IoCtx &io_ctx, librbd::asio::ContextWQ *work_queue,
                   InstanceReplayer<ImageCtxT> *instance_replayer,
                   Throttler<ImageCtxT> *image_sync_throttler,
                   const std::string &instance_id);
index c3643af2c08623d4b32de054e368e6826696d75a..d5ac0614f0ee0984c76d57f0aea414c32912e2de 100644 (file)
@@ -3,10 +3,10 @@
 
 #include "include/stringify.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "common/debug.h"
 #include "common/errno.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "InstanceWatcher.h"
 #include "Instances.h"
 #include "Threads.h"
index ae705e3c5e263442abf5b35d0f2d1d5b8a48c7bc..844d7c7811da3991d951acc870653804f50ca630 100644 (file)
@@ -9,6 +9,7 @@
 #include "cls/rbd/cls_rbd_client.h"
 #include "include/stringify.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/watcher/Types.h"
 #include "Threads.h"
 
index f4573a5b1d99d04fbd5a8e69b1e5e5a83b7e58c1..60dbd20bd996a0fd3dfcfd817cd520866fbae4b4 100644 (file)
 #include "tools/rbd_mirror/instances/Types.h"
 #include "tools/rbd_mirror/leader_watcher/Types.h"
 
-namespace librbd { class ImageCtx; }
+namespace librbd {
+class ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -116,7 +119,7 @@ private:
   public:
     typedef librbd::ManagedLock<ImageCtxT> Parent;
 
-    LeaderLock(librados::IoCtx& ioctx, ContextWQ *work_queue,
+    LeaderLock(librados::IoCtx& ioctx, librbd::asio::ContextWQ *work_queue,
                const std::string& oid, LeaderWatcher *watcher,
                bool blacklist_on_break_lock,
                uint32_t blacklist_expire_seconds)
index 9d27734c3d0262ae14a89a8512fd758bc5de2744..0530db601f3bc2ca6ecb07432827f8c7144b464f 100644 (file)
@@ -7,9 +7,9 @@
 #include "common/debug.h"
 #include "common/errno.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "tools/rbd_mirror/MirrorStatusWatcher.h"
 #include "tools/rbd_mirror/Threads.h"
 
index 219f3e302a3d6c80bc2f9b6268cf6613c73b8e63..3e1564c5b707217e6a748dd1cb500137c5b27e7a 100644 (file)
@@ -20,7 +20,7 @@ using librbd::util::create_rados_callback;
 
 template <typename I>
 MirrorStatusWatcher<I>::MirrorStatusWatcher(librados::IoCtx &io_ctx,
-                                            ContextWQ *work_queue)
+                                            librbd::asio::ContextWQ *work_queue)
   : Watcher(io_ctx, work_queue, RBD_MIRRORING) {
 }
 
index 155f8cc8d05ad16f27d902cb23567e411af416b5..3335e9e63ad6aa2acb059fd137c8c129e2e5a7f8 100644 (file)
@@ -6,7 +6,10 @@
 
 #include "librbd/Watcher.h"
 
-namespace librbd { class ImageCtx; }
+namespace librbd {
+class ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -15,14 +18,15 @@ template <typename ImageCtxT = librbd::ImageCtx>
 class MirrorStatusWatcher : protected librbd::Watcher {
 public:
   static MirrorStatusWatcher *create(librados::IoCtx &io_ctx,
-                                     ContextWQ *work_queue) {
+                                     librbd::asio::ContextWQ *work_queue) {
     return new MirrorStatusWatcher(io_ctx, work_queue);
   }
   void destroy() {
     delete this;
   }
 
-  MirrorStatusWatcher(librados::IoCtx &io_ctx, ContextWQ *work_queue);
+  MirrorStatusWatcher(librados::IoCtx &io_ctx,
+                      librbd::asio::ContextWQ *work_queue);
   ~MirrorStatusWatcher() override;
 
   void init(Context *on_finish);
index 7d5a7a0cc38ab9cbd96979b1c16610364a8a1dd3..10382c914b6e33004f4858c95f39eee684548252 100644 (file)
@@ -10,6 +10,7 @@
 #include "librbd/Utils.h"
 #include "librbd/api/Config.h"
 #include "librbd/api/Mirror.h"
+#include "librbd/asio/ContextWQ.h"
 #include "ServiceDaemon.h"
 #include "Threads.h"
 
index 5396106e175b12b64a40abaef6a216e8d1cca397..4e0756ee2aba2179d048a0a3200b6b5645527001 100644 (file)
@@ -5,7 +5,6 @@
 #define CEPH_RBD_MIRROR_NAMESPACE_REPLAYER_H
 
 #include "common/AsyncOpTracker.h"
-#include "common/WorkQueue.h"
 #include "common/ceph_mutex.h"
 #include "include/rados/librados.hpp"
 
index 5ac84dd264569f7da15f570cba49f1f8309947c8..21437451c1a606e7da4d2ee5c6d4332a655b4474 100644 (file)
@@ -5,10 +5,10 @@
 #define CEPH_RBD_MIRROR_POOL_REPLAYER_H
 
 #include "common/Cond.h"
-#include "common/WorkQueue.h"
 #include "common/ceph_mutex.h"
 #include "include/rados/librados.hpp"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 
 #include "tools/rbd_mirror/LeaderWatcher.h"
 #include "tools/rbd_mirror/NamespaceReplayer.h"
index 359ca95d5377204a443e73ae97697c3b21e17bbe..9fa8e88811d06b7eb7861e030fb4541f474b0f0b 100644 (file)
@@ -13,6 +13,7 @@
 #include "librbd/Utils.h"
 #include "librbd/api/Image.h"
 #include "librbd/api/Mirror.h"
+#include "librbd/asio/ContextWQ.h"
 #include "tools/rbd_mirror/Threads.h"
 #include "tools/rbd_mirror/pool_watcher/RefreshImagesRequest.h"
 #include <boost/bind.hpp>
index 52c64c2d2c1bbde18ae4648a897aba8a7677b3d6..4f5994f1da6781a487465952cec2d140095b683b 100644 (file)
@@ -6,10 +6,10 @@
 #include "common/debug.h"
 #include "common/errno.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "tools/rbd_mirror/Threads.h"
 #include "tools/rbd_mirror/Types.h"
 
index 2ec0cf2a44d0ffbd4cbe18101e2042d204d19e82..702f26a0852d6eff025088b3b35ed153def39ae5 100644 (file)
@@ -3,22 +3,17 @@
 
 #include "tools/rbd_mirror/Threads.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
+#include "librbd/AsioEngine.h"
 #include "librbd/ImageCtx.h"
+#include "librbd/asio/ContextWQ.h"
 
 namespace rbd {
 namespace mirror {
 
 template <typename I>
 Threads<I>::Threads(CephContext *cct) {
-  thread_pool = new ThreadPool(cct, "Journaler::thread_pool", "tp_journal",
-                               cct->_conf.get_val<uint64_t>("rbd_op_threads"),
-                               "rbd_op_threads");
-  thread_pool->start();
-
-  work_queue = new ContextWQ("Journaler::work_queue",
-                             cct->_conf.get_val<uint64_t>("rbd_op_thread_timeout"),
-                             thread_pool);
+  asio_engine = new librbd::AsioEngine(cct);
+  work_queue = asio_engine->get_work_queue();
 
   timer = new SafeTimer(cct, timer_lock, true);
   timer->init();
@@ -33,10 +28,7 @@ Threads<I>::~Threads() {
   delete timer;
 
   work_queue->drain();
-  delete work_queue;
-
-  thread_pool->stop();
-  delete thread_pool;
+  delete asio_engine;
 }
 
 } // namespace mirror
index 04e1848b503b0da9b8de8eb2afa8de6c82a586ac..91c086b1e31e259123aea7a7187a24d8780dc15d 100644 (file)
@@ -7,23 +7,28 @@
 #include "include/common_fwd.h"
 #include "common/ceph_mutex.h"
 
-class ContextWQ;
 class SafeTimer;
 class ThreadPool;
 
-namespace librbd { struct ImageCtx; }
+namespace librbd {
+struct AsioEngine;
+struct ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
 
 template <typename ImageCtxT = librbd::ImageCtx>
-struct Threads {
-  ThreadPool *thread_pool = nullptr;
-  ContextWQ *work_queue = nullptr;
+class Threads {
+private:
+  librbd::AsioEngine* asio_engine = nullptr;
+
+public:
+  librbd::asio::ContextWQ* work_queue = nullptr;
 
   SafeTimer *timer = nullptr;
-  ceph::mutex timer_lock =
-    ceph::make_mutex("Threads::timer_lock");
+  ceph::mutex timer_lock = ceph::make_mutex("Threads::timer_lock");
 
   explicit Threads(CephContext *cct);
   Threads(const Threads&) = delete;
index 0eadca7bf2a86eda3f5a03971a3fac1a2ba113a2..243651bba0d46a938cbdf0d9401d9161b265524e 100644 (file)
@@ -6,12 +6,14 @@
 #include "cls/rbd/cls_rbd_client.h"
 #include "common/debug.h"
 #include "common/errno.h"
+#include "common/WorkQueue.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/Journal.h"
 #include "librbd/TrashWatcher.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/ResetRequest.h"
 #include "librbd/mirror/GetInfoRequest.h"
 #include "librbd/trash/MoveRequest.h"
@@ -207,12 +209,17 @@ void TrashMoveRequest<I>::reset_journal() {
 
   dout(10) << dendl;
 
+  // TODO use Journal thread pool for journal ops until converted to ASIO
+  ContextWQ* context_wq;
+  librbd::Journal<>::get_work_queue(
+    reinterpret_cast<CephContext*>(m_io_ctx.cct()), &context_wq);
+
   // ensure that if the image is recovered any peers will split-brain
   auto ctx = create_context_callback<
     TrashMoveRequest<I>, &TrashMoveRequest<I>::handle_reset_journal>(this);
   auto req = librbd::journal::ResetRequest<I>::create(
     m_io_ctx, m_image_id, librbd::Journal<>::IMAGE_CLIENT_ID,
-    librbd::Journal<>::LOCAL_MIRROR_UUID, m_op_work_queue, ctx);
+    librbd::Journal<>::LOCAL_MIRROR_UUID, context_wq, ctx);
   req->send();
 }
 
index fa0d7daca1b3e8556cae62967a11f93757685374..5b3f025194be88465af513ab2d25699d5c76bfdd 100644 (file)
 #include <string>
 
 struct Context;
-class ContextWQ;
-namespace librbd { struct ImageCtx; }
+namespace librbd {
+struct ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -23,14 +25,16 @@ class TrashMoveRequest {
 public:
   static TrashMoveRequest* create(librados::IoCtx& io_ctx,
                                   const std::string& global_image_id,
-                                  bool resync, ContextWQ* op_work_queue,
+                                  bool resync,
+                                  librbd::asio::ContextWQ* op_work_queue,
                                   Context* on_finish) {
     return new TrashMoveRequest(io_ctx, global_image_id, resync, op_work_queue,
                                 on_finish);
   }
 
   TrashMoveRequest(librados::IoCtx& io_ctx, const std::string& global_image_id,
-                   bool resync, ContextWQ* op_work_queue, Context* on_finish)
+                   bool resync, librbd::asio::ContextWQ* op_work_queue,
+                   Context* on_finish)
     : m_io_ctx(io_ctx), m_global_image_id(global_image_id), m_resync(resync),
       m_op_work_queue(op_work_queue), m_on_finish(on_finish) {
   }
@@ -82,7 +86,7 @@ private:
   librados::IoCtx &m_io_ctx;
   std::string m_global_image_id;
   bool m_resync;
-  ContextWQ *m_op_work_queue;
+  librbd::asio::ContextWQ *m_op_work_queue;
   Context *m_on_finish;
 
   ceph::bufferlist m_out_bl;
index 2ffcdfa4bd0fa911a523542b9a2dae1bd76c435a..4d7c1c9df200d960716a0d5f1378b93b17b972aa 100644 (file)
@@ -10,6 +10,7 @@
 #include "librbd/ImageCtx.h"
 #include "librbd/TrashWatcher.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/trash/RemoveRequest.h"
 #include "tools/rbd_mirror/image_deleter/SnapshotPurgeRequest.h"
 
index d2295e8ed2ab2c23b0b0e379f2cf9205192a99b7..b99736b33327dd3e5098429e8bdba7644a70410d 100644 (file)
 
 class Context;
 class ContextWQ;
-namespace librbd { struct ImageCtx; }
+namespace librbd {
+struct ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -26,14 +29,15 @@ public:
   static TrashRemoveRequest* create(librados::IoCtx &io_ctx,
                                     const std::string &image_id,
                                     ErrorResult *error_result,
-                                    ContextWQ *op_work_queue,
+                                    librbd::asio::ContextWQ *op_work_queue,
                                     Context *on_finish) {
     return new TrashRemoveRequest(io_ctx, image_id, error_result, op_work_queue,
                                   on_finish);
   }
 
   TrashRemoveRequest(librados::IoCtx &io_ctx, const std::string &image_id,
-                     ErrorResult *error_result, ContextWQ *op_work_queue,
+                     ErrorResult *error_result,
+                     librbd::asio::ContextWQ *op_work_queue,
                      Context *on_finish)
     : m_io_ctx(io_ctx), m_image_id(image_id), m_error_result(error_result),
       m_op_work_queue(op_work_queue), m_on_finish(on_finish) {
@@ -74,7 +78,7 @@ private:
   librados::IoCtx &m_io_ctx;
   std::string m_image_id;
   ErrorResult *m_error_result;
-  ContextWQ *m_op_work_queue;
+  librbd::asio::ContextWQ *m_op_work_queue;
   Context *m_on_finish;
 
   ceph::bufferlist m_out_bl;
index e68cac9d5782d7687e1a53866ddd03a1a6403839..7f5b8e34bd0920da405a4d58a5cb13cfb4fefbd6 100644 (file)
@@ -9,6 +9,7 @@
 #include "common/Timer.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "tools/rbd_mirror/Threads.h"
 #include "tools/rbd_mirror/image_deleter/Types.h"
 
index 7241618be2b9a81c4462ba39acd168a689f7f1a1..1671bb9f6a65bcfae76ec1a40984f0119451e552 100644 (file)
@@ -9,7 +9,6 @@
 #include "common/debug.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "journal/Journaler.h"
 #include "journal/Settings.h"
@@ -18,6 +17,7 @@
 #include "librbd/internal.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/Types.h"
 #include "tools/rbd_mirror/BaseRequest.h"
 #include "tools/rbd_mirror/ImageSync.h"
index cc15a91334b8a758162f6c6a33faa4b42e44e75b..3d17ae48bc2fd26fda5212c00bbcb1617e5592ef 100644 (file)
@@ -14,7 +14,6 @@
 #include <string>
 
 class Context;
-class ContextWQ;
 class SafeTimer;
 
 namespace journal { class CacheManagerHandler; }
index 5b7548230dbb09cbdf76f3986e877abc72266b93..10ab661e277114abae322fd16bbcbbb4fb689b16 100644 (file)
@@ -4,7 +4,6 @@
 #include "CloseImageRequest.h"
 #include "common/debug.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/Utils.h"
index 3cd57afc5f0865809493969bdbaf73fe36465cfe..d7266b260ad239c4056e76662760981401e3ced7 100644 (file)
@@ -6,12 +6,12 @@
 #include "OpenImageRequest.h"
 #include "common/debug.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/internal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/image/CreateRequest.h"
 #include "librbd/image/CloneRequest.h"
 #include "tools/rbd_mirror/PoolMetaCache.h"
index eda12cdb3f989c5bdbef0c7b3ceb13253e8e55be..2ff7794e81aec9a51a4f4e4a6c2bb83526a7c9ff 100644 (file)
@@ -12,7 +12,6 @@
 #include <string>
 
 class Context;
-class ContextWQ;
 namespace librbd { class ImageCtx; }
 namespace librbd { class ImageOptions; }
 
index 2418cf3a9c7502358f01bf732eeec227e6e02294..8040cd214ba11e9d0e7a0aca99e8154bcd4b3ecc 100644 (file)
@@ -6,12 +6,12 @@
 #include "OpenLocalImageRequest.h"
 #include "common/debug.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "librbd/ExclusiveLock.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/exclusive_lock/Policy.h"
 #include "librbd/journal/Policy.h"
 #include "librbd/mirror/GetInfoRequest.h"
@@ -73,9 +73,10 @@ struct MirrorExclusiveLockPolicy : public librbd::exclusive_lock::Policy {
 };
 
 struct MirrorJournalPolicy : public librbd::journal::Policy {
-  ContextWQ *work_queue;
+  librbd::asio::ContextWQ *work_queue;
 
-  MirrorJournalPolicy(ContextWQ *work_queue) : work_queue(work_queue) {
+  MirrorJournalPolicy(librbd::asio::ContextWQ *work_queue)
+    : work_queue(work_queue) {
   }
 
   bool append_disabled() const override {
@@ -95,11 +96,12 @@ struct MirrorJournalPolicy : public librbd::journal::Policy {
 } // anonymous namespace
 
 template <typename I>
-OpenLocalImageRequest<I>::OpenLocalImageRequest(librados::IoCtx &local_io_ctx,
-                                                I **local_image_ctx,
-                                                const std::string &local_image_id,
-                                                ContextWQ *work_queue,
-                                                Context *on_finish)
+OpenLocalImageRequest<I>::OpenLocalImageRequest(
+    librados::IoCtx &local_io_ctx,
+    I **local_image_ctx,
+    const std::string &local_image_id,
+    librbd::asio::ContextWQ *work_queue,
+    Context *on_finish)
   : m_local_io_ctx(local_io_ctx), m_local_image_ctx(local_image_ctx),
     m_local_image_id(local_image_id), m_work_queue(work_queue),
     m_on_finish(on_finish) {
index 31e7add9575083012373685d90b83004c00bdae4..9a642bc39311c8e22ddc1543dbde41475c18ce18 100644 (file)
 #include <string>
 
 class Context;
-class ContextWQ;
-namespace librbd { class ImageCtx; }
+namespace librbd {
+class ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -24,7 +26,7 @@ public:
   static OpenLocalImageRequest* create(librados::IoCtx &local_io_ctx,
                                        ImageCtxT **local_image_ctx,
                                        const std::string &local_image_id,
-                                       ContextWQ *work_queue,
+                                       librbd::asio::ContextWQ *work_queue,
                                        Context *on_finish) {
     return new OpenLocalImageRequest(local_io_ctx, local_image_ctx,
                                      local_image_id, work_queue, on_finish);
@@ -33,7 +35,7 @@ public:
   OpenLocalImageRequest(librados::IoCtx &local_io_ctx,
                         ImageCtxT **local_image_ctx,
                         const std::string &local_image_id,
-                        ContextWQ *m_work_queue,
+                        librbd::asio::ContextWQ *work_queue,
                         Context *on_finish);
 
   void send();
@@ -61,7 +63,7 @@ private:
   librados::IoCtx &m_local_io_ctx;
   ImageCtxT **m_local_image_ctx;
   std::string m_local_image_id;
-  ContextWQ *m_work_queue;
+  librbd::asio::ContextWQ *m_work_queue;
   Context *m_on_finish;
 
   cls::rbd::MirrorImage m_mirror_image;
index 05473c204aed4493e1c84379722d555b8bff0802..8285ca060b3e322e027f290dab0d70ecd7d5cfd9 100644 (file)
 #include "librbd/mirror/Types.h"
 #include <string>
 
-namespace librbd { struct ImageCtx; }
-
 struct Context;
-struct ContextWQ;
+
+namespace librbd {
+struct ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -29,7 +31,7 @@ public:
       const std::string &global_image_id,
       std::string *local_image_name,
       StateBuilder<ImageCtxT>** state_builder,
-      ContextWQ *work_queue,
+      librbd::asio::ContextWQ *work_queue,
       Context *on_finish) {
     return new PrepareLocalImageRequest(io_ctx, global_image_id,
                                         local_image_name, state_builder,
@@ -41,7 +43,7 @@ public:
       const std::string &global_image_id,
       std::string *local_image_name,
       StateBuilder<ImageCtxT>** state_builder,
-      ContextWQ *work_queue,
+      librbd::asio::ContextWQ *work_queue,
       Context *on_finish)
     : m_io_ctx(io_ctx), m_global_image_id(global_image_id),
       m_local_image_name(local_image_name), m_state_builder(state_builder),
@@ -75,7 +77,7 @@ private:
   std::string m_global_image_id;
   std::string *m_local_image_name;
   StateBuilder<ImageCtxT>** m_state_builder;
-  ContextWQ *m_work_queue;
+  librbd::asio::ContextWQ *m_work_queue;
   Context *m_on_finish;
 
   bufferlist m_out_bl;
index 3231d5fa02397f1f8bde18977becd1688ea7b58f..54a9dbf1650d532bb5b7a464d86e8d283780677a 100644 (file)
@@ -6,11 +6,12 @@
 #include "cls/rbd/cls_rbd_client.h"
 #include "common/debug.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/mirror/GetInfoRequest.h"
 #include "tools/rbd_mirror/Threads.h"
 #include "tools/rbd_mirror/image_replayer/GetMirrorImageIdRequest.h"
@@ -149,8 +150,12 @@ void PrepareRemoteImageRequest<I>::get_client() {
   journal_settings.commit_interval = cct->_conf.get_val<double>(
     "rbd_mirror_journal_commit_age");
 
+  // TODO use Journal thread pool for journal ops until converted to ASIO
+  ContextWQ* context_wq;
+  librbd::Journal<>::get_work_queue(cct, &context_wq);
+
   ceph_assert(m_remote_journaler == nullptr);
-  m_remote_journaler = new Journaler(m_threads->work_queue, m_threads->timer,
+  m_remote_journaler = new Journaler(context_wq, m_threads->timer,
                                      &m_threads->timer_lock, m_remote_io_ctx,
                                      m_remote_image_id, m_local_mirror_uuid,
                                      journal_settings, m_cache_manager_handler);
index 8006c50666a0695a7a783d35ce4fb43546270d4d..0d0129d55826bb98ec44bb13699a298ef75cccf6 100644 (file)
@@ -20,7 +20,6 @@ namespace librbd { struct ImageCtx; }
 namespace librbd { namespace journal { struct MirrorPeerClientMeta; } }
 
 struct Context;
-struct ContextWQ;
 
 namespace rbd {
 namespace mirror {
index c1568073cf3365f6100a27c123b346f4a7c3b160..f5d49048e6d4e2ea2714901313ff4afe66fae90c 100644 (file)
@@ -5,11 +5,11 @@
 #include "common/debug.h"
 #include "common/dout.h"
 #include "common/errno.h"
-#include "common/WorkQueue.h"
 #include "journal/Journaler.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/Types.h"
 #include <boost/variant.hpp>
 
@@ -33,7 +33,7 @@ EventPreprocessor<I>::EventPreprocessor(I &local_image_ctx,
                                         Journaler &remote_journaler,
                                         const std::string &local_mirror_uuid,
                                         MirrorPeerClientMeta *client_meta,
-                                        ContextWQ *work_queue)
+                                        librbd::asio::ContextWQ *work_queue)
   : m_local_image_ctx(local_image_ctx), m_remote_journaler(remote_journaler),
     m_local_mirror_uuid(local_mirror_uuid), m_client_meta(client_meta),
     m_work_queue(work_queue) {
index 5844e6f748376ace7587bba7723352ee320e6822..12f70eb9350a319d1a2b703d59377ea0f22d0042 100644 (file)
 #include <boost/variant/static_visitor.hpp>
 
 struct Context;
-struct ContextWQ;
 namespace journal { class Journaler; }
-namespace librbd { class ImageCtx; }
+namespace librbd {
+class ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
 
 namespace rbd {
 namespace mirror {
@@ -32,7 +34,7 @@ public:
                                    Journaler &remote_journaler,
                                    const std::string &local_mirror_uuid,
                                    MirrorPeerClientMeta *client_meta,
-                                   ContextWQ *work_queue) {
+                                   librbd::asio::ContextWQ *work_queue) {
     return new EventPreprocessor(local_image_ctx, remote_journaler,
                                  local_mirror_uuid, client_meta, work_queue);
   }
@@ -43,7 +45,8 @@ public:
 
   EventPreprocessor(ImageCtxT &local_image_ctx, Journaler &remote_journaler,
                     const std::string &local_mirror_uuid,
-                    MirrorPeerClientMeta *client_meta, ContextWQ *work_queue);
+                    MirrorPeerClientMeta *client_meta,
+                    librbd::asio::ContextWQ *work_queue);
   ~EventPreprocessor();
 
   bool is_required(const EventEntry &event_entry);
@@ -90,7 +93,7 @@ private:
   Journaler &m_remote_journaler;
   std::string m_local_mirror_uuid;
   MirrorPeerClientMeta *m_client_meta;
-  ContextWQ *m_work_queue;
+  librbd::asio::ContextWQ *m_work_queue;
 
   bool m_in_progress = false;
   EventEntry *m_event_entry = nullptr;
index 60b9a7e59319ad6399adcceb675348aff519375c..ea0f9093c3b7c98fa69e7a83b2d82c1c2564b0d5 100644 (file)
@@ -5,9 +5,9 @@
 #include "common/debug.h"
 #include "common/errno.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "librbd/Journal.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/journal/Replay.h"
 #include "journal/Journaler.h"
 #include "journal/JournalMetadataListener.h"
index 0f149f0d1d89968edb42121b46b7db088dee876b..6c4d842f1fd5e39237e029821e2a32428d7cfe01 100644 (file)
@@ -6,13 +6,13 @@
 #include "common/errno.h"
 #include "include/stringify.h"
 #include "common/Timer.h"
-#include "common/WorkQueue.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "json_spirit/json_spirit.h"
 #include "librbd/ImageCtx.h"
 #include "librbd/ImageState.h"
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
+#include "librbd/asio/ContextWQ.h"
 #include "librbd/deep_copy/Handler.h"
 #include "librbd/deep_copy/ImageCopyRequest.h"
 #include "librbd/deep_copy/SnapshotCopyRequest.h"