From: lixiaoy1 Date: Fri, 20 Nov 2020 11:06:15 +0000 (-0500) Subject: librbd/plugin: delete field m_image_ctx X-Git-Tag: v16.1.0~502^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38201%2Fhead;p=ceph.git librbd/plugin: delete field m_image_ctx librbd::plugin::ParentCache may be shared by more than one images. Signed-off-by: Li, Xiaoyan --- diff --git a/src/librbd/plugin/ParentCache.cc b/src/librbd/plugin/ParentCache.cc index 0c50c8e7197..cdbe8ff9b3c 100644 --- a/src/librbd/plugin/ParentCache.cc +++ b/src/librbd/plugin/ParentCache.cc @@ -35,20 +35,19 @@ namespace plugin { template void ParentCache::init(I* image_ctx, Api& api, HookPoints* hook_points, Context* on_finish) { - m_image_ctx = image_ctx; - bool parent_cache_enabled = m_image_ctx->config.template get_val( + bool parent_cache_enabled = image_ctx->config.template get_val( "rbd_parent_cache_enabled"); - if (m_image_ctx->child == nullptr || !parent_cache_enabled || - !m_image_ctx->data_ctx.is_valid()) { + if (image_ctx->child == nullptr || !parent_cache_enabled || + !image_ctx->data_ctx.is_valid()) { on_finish->complete(0); return; } - auto cct = m_image_ctx->cct; + auto cct = image_ctx->cct; ldout(cct, 5) << dendl; auto parent_cache = cache::ParentCacheObjectDispatch::create( - m_image_ctx, api); + image_ctx, api); on_finish = new LambdaContext([this, on_finish, parent_cache](int r) { if (r < 0) { // the object dispatcher will handle cleanup if successfully initialized @@ -62,7 +61,6 @@ void ParentCache::init(I* image_ctx, Api& api, HookPoints* hook_points, template void ParentCache::handle_init_parent_cache(int r, Context* on_finish) { - auto cct = m_image_ctx->cct; ldout(cct, 5) << "r=" << r << dendl; if (r < 0) { diff --git a/src/librbd/plugin/ParentCache.h b/src/librbd/plugin/ParentCache.h index e456c5ac3d8..276170b258c 100644 --- a/src/librbd/plugin/ParentCache.h +++ b/src/librbd/plugin/ParentCache.h @@ -23,9 +23,8 @@ public: Context* on_finish) override; private: - ImageCtxT* m_image_ctx = nullptr; - void handle_init_parent_cache(int r, Context* on_finish); + using ceph::Plugin::cct; };