From: Prasanna Kumar Kalever Date: Thu, 6 Mar 2025 07:53:19 +0000 (+0530) Subject: rbd-mirror: reverting changes to ImageSync X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9898e318be61820c91a7a3285cf0c7d120c20160;p=ceph.git rbd-mirror: reverting changes to ImageSync ImageSync should never be needed for snapshot-based mirroring. Credits and thanks to Nithya and Ilya for highlighting it. Signed-off-by: Prasanna Kumar Kalever --- diff --git a/src/test/rbd_mirror/test_ImageSync.cc b/src/test/rbd_mirror/test_ImageSync.cc index 06cc0f65f3cfc..9418496bce2d4 100644 --- a/src/test/rbd_mirror/test_ImageSync.cc +++ b/src/test/rbd_mirror/test_ImageSync.cc @@ -136,10 +136,9 @@ public: } ImageSync<> *create_request(Context *ctx) { - return new ImageSync<>(m_threads, nullptr, m_local_image_ctx, - m_remote_image_ctx, "mirror-uuid", - m_sync_point_handler, m_instance_watcher, nullptr, - ctx); + return new ImageSync<>(m_threads, m_local_image_ctx, m_remote_image_ctx, + "mirror-uuid", m_sync_point_handler, + m_instance_watcher, nullptr, ctx); } librbd::ImageCtx *m_remote_image_ctx; diff --git a/src/tools/rbd_mirror/ImageSync.cc b/src/tools/rbd_mirror/ImageSync.cc index fcd659131994e..b0434bef6c5ac 100644 --- a/src/tools/rbd_mirror/ImageSync.cc +++ b/src/tools/rbd_mirror/ImageSync.cc @@ -15,7 +15,6 @@ #include "librbd/asio/ContextWQ.h" #include "librbd/deep_copy/Handler.h" #include "tools/rbd_mirror/Threads.h" -#include "tools/rbd_mirror/Types.h" #include "tools/rbd_mirror/image_sync/SyncPointCreateRequest.h" #include "tools/rbd_mirror/image_sync/SyncPointPruneRequest.h" #include "tools/rbd_mirror/image_sync/Types.h" @@ -54,7 +53,6 @@ public: template ImageSync::ImageSync( Threads* threads, - GroupCtx *local_group_ctx, I *local_image_ctx, I *remote_image_ctx, const std::string &local_mirror_uuid, @@ -75,12 +73,6 @@ ImageSync::ImageSync( m_update_sync_point_interval( m_local_image_ctx->cct->_conf.template get_val( "rbd_mirror_sync_point_update_age")) { - if (local_group_ctx == nullptr) { - m_sync_id = m_local_image_ctx->id; - } else { - m_sync_id = stringify(m_local_image_ctx->md_ctx.get_id()) + ":" + - m_local_image_ctx->id; - } } template @@ -103,7 +95,7 @@ void ImageSync::cancel() { m_canceled = true; - if (m_instance_watcher->cancel_sync_request(m_sync_id)) { + if (m_instance_watcher->cancel_sync_request(m_local_image_ctx->id)) { return; } @@ -128,7 +120,7 @@ void ImageSync::send_notify_sync_request() { Context *ctx = create_async_context_callback( m_threads->work_queue, create_context_callback< ImageSync, &ImageSync::handle_notify_sync_request>(this)); - m_instance_watcher->notify_sync_request(m_sync_id, ctx); + m_instance_watcher->notify_sync_request(m_local_image_ctx->id, ctx); m_lock.unlock(); } @@ -469,7 +461,7 @@ template void ImageSync::finish(int r) { dout(20) << ": r=" << r << dendl; - m_instance_watcher->notify_sync_complete(m_sync_id); + m_instance_watcher->notify_sync_complete(m_local_image_ctx->id); CancelableRequest::finish(r); } diff --git a/src/tools/rbd_mirror/ImageSync.h b/src/tools/rbd_mirror/ImageSync.h index c56d376d9522c..b3389ce18fec8 100644 --- a/src/tools/rbd_mirror/ImageSync.h +++ b/src/tools/rbd_mirror/ImageSync.h @@ -21,7 +21,6 @@ namespace mirror { class ProgressContext; template class InstanceWatcher; template class Threads; -struct GroupCtx; namespace image_sync { struct SyncPointHandler; } @@ -30,7 +29,6 @@ class ImageSync : public CancelableRequest { public: static ImageSync* create( Threads* threads, - GroupCtx *local_group_ctx, ImageCtxT *local_image_ctx, ImageCtxT *remote_image_ctx, const std::string &local_mirror_uuid, @@ -38,15 +36,13 @@ public: InstanceWatcher *instance_watcher, ProgressContext *progress_ctx, Context *on_finish) { - return new ImageSync(threads, local_group_ctx, local_image_ctx, - remote_image_ctx, local_mirror_uuid, - sync_point_handler, instance_watcher, progress_ctx, - on_finish); + return new ImageSync(threads, local_image_ctx, remote_image_ctx, + local_mirror_uuid, sync_point_handler, + instance_watcher, progress_ctx, on_finish); } ImageSync( Threads* threads, - GroupCtx *local_group_ctx, ImageCtxT *local_image_ctx, ImageCtxT *remote_image_ctx, const std::string &local_mirror_uuid, @@ -104,7 +100,6 @@ private: ceph::mutex m_lock; bool m_canceled = false; - std::string m_sync_id; librbd::DeepCopyRequest *m_image_copy_request = nullptr; ImageCopyProgressHandler *m_image_copy_prog_handler = nullptr; diff --git a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc index 10312769e2c4b..e9a17b9858447 100644 --- a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc @@ -407,9 +407,9 @@ void BootstrapRequest::image_sync() { Context *ctx = create_context_callback< BootstrapRequest, &BootstrapRequest::handle_image_sync>(this); m_image_sync = ImageSync::create( - m_threads, m_local_group_ctx, state_builder->local_image_ctx, - state_builder->remote_image_ctx, m_local_mirror_uuid, sync_point_handler, - m_instance_watcher, m_progress_ctx, ctx); + m_threads, state_builder->local_image_ctx, state_builder->remote_image_ctx, + m_local_mirror_uuid, sync_point_handler, m_instance_watcher, + m_progress_ctx, ctx); m_image_sync->get(); locker.unlock();