From ce2ae1d7c0f8818c86cbc746921e8eb6b0f89913 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 17 Oct 2017 14:57:08 -0400 Subject: [PATCH] librbd: track the child of an image in-memory Signed-off-by: Jason Dillaman --- src/librbd/ImageCtx.h | 1 + src/librbd/image/RefreshParentRequest.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index ed77e339d64..830c8900d0a 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -125,6 +125,7 @@ namespace librbd { std::string id; // only used for new-format images ParentInfo parent_md; ImageCtx *parent; + ImageCtx *child = nullptr; cls::rbd::GroupSpec group_spec; uint64_t stripe_unit, stripe_count; uint64_t flags; diff --git a/src/librbd/image/RefreshParentRequest.cc b/src/librbd/image/RefreshParentRequest.cc index 86001da82c6..9ad7ed05d0a 100644 --- a/src/librbd/image/RefreshParentRequest.cc +++ b/src/librbd/image/RefreshParentRequest.cc @@ -109,6 +109,7 @@ void RefreshParentRequest::send_open_parent() { // reset the snap_name and snap_exists fields after we read the header m_parent_image_ctx = new I("", m_parent_md.spec.image_id, NULL, parent_io_ctx, true); + m_parent_image_ctx->child = &m_child_image_ctx; // set rados flags for reading the parent image if (m_child_image_ctx.balance_parent_reads) { -- 2.47.3