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;
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,
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) {
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),
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),
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;
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;
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),
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,
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,
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),
#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"
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"};
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;
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),
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,
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),
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)
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");
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),
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);
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),
#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"
}
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);
}
#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"
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;
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 {
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);
#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"
#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"
#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"
#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"
#include "tools/rbd_mirror/image_sync/Types.h"
class Context;
-class ContextWQ;
namespace journal { class Journaler; }
namespace librbd { template <typename> class DeepCopyRequest; }
#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"
#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"
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) {
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,
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,
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)
class ImageCtx;
template <typename> class ManagedLock;
+namespace asio { struct ContextWQ; }
-}
+} // namespace librbd
namespace rbd {
namespace mirror {
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);
#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"
#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"
#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 {
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)
#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"
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) {
}
#include "librbd/Watcher.h"
-namespace librbd { class ImageCtx; }
+namespace librbd {
+class ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
namespace rbd {
namespace mirror {
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);
#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"
#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"
#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"
#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>
#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"
#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();
delete timer;
work_queue->drain();
- delete work_queue;
-
- thread_pool->stop();
- delete thread_pool;
+ delete asio_engine;
}
} // namespace mirror
#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;
#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"
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();
}
#include <string>
struct Context;
-class ContextWQ;
-namespace librbd { struct ImageCtx; }
+namespace librbd {
+struct ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
namespace rbd {
namespace mirror {
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) {
}
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;
#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"
class Context;
class ContextWQ;
-namespace librbd { struct ImageCtx; }
+namespace librbd {
+struct ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
namespace rbd {
namespace mirror {
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) {
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;
#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"
#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"
#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"
#include <string>
class Context;
-class ContextWQ;
class SafeTimer;
namespace journal { class CacheManagerHandler; }
#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"
#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"
#include <string>
class Context;
-class ContextWQ;
namespace librbd { class ImageCtx; }
namespace librbd { class ImageOptions; }
#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"
};
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 {
} // 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) {
#include <string>
class Context;
-class ContextWQ;
-namespace librbd { class ImageCtx; }
+namespace librbd {
+class ImageCtx;
+namespace asio { struct ContextWQ; }
+} // namespace librbd
namespace rbd {
namespace mirror {
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);
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();
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;
#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 {
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,
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),
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;
#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"
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);
namespace librbd { namespace journal { struct MirrorPeerClientMeta; } }
struct Context;
-struct ContextWQ;
namespace rbd {
namespace mirror {
#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>
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) {
#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 {
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);
}
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);
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;
#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"
#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"