From: shangdehao1 Date: Mon, 10 Jun 2019 01:19:36 +0000 (+0800) Subject: librbd: remove parent cache config from ImageCtx X-Git-Tag: v15.1.0~2379^2~7 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=65eb28fbe411a5eafd2aac450f1730e3f496c095;p=ceph-ci.git librbd: remove parent cache config from ImageCtx Signed-off-by: Dehao Shang --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 2772c836e2b..5a8bf337745 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -769,7 +769,6 @@ public: ASSIGN_OPTION(skip_partial_discard, bool); ASSIGN_OPTION(discard_granularity_bytes, uint64_t); ASSIGN_OPTION(blkin_trace_all, bool); - ASSIGN_OPTION(parent_cache_enabled, bool); #undef ASSIGN_OPTION diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index 7864e9a157c..32f5f5f2b96 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -195,9 +195,6 @@ namespace librbd { uint64_t mtime_update_interval; uint64_t atime_update_interval; - bool parent_cache_enabled; - std::string shared_cache_path; - LibrbdAdminSocketHook *asok_hook; exclusive_lock::Policy *exclusive_lock_policy = nullptr; diff --git a/src/librbd/cache/ParentCacheObjectDispatch.cc b/src/librbd/cache/ParentCacheObjectDispatch.cc index b6428b193bf..cafbd5c2c73 100644 --- a/src/librbd/cache/ParentCacheObjectDispatch.cc +++ b/src/librbd/cache/ParentCacheObjectDispatch.cc @@ -146,7 +146,7 @@ int ParentCacheObjectDispatch::handle_register_client(bool reg) { if (reg) { ldout(cct, 20) << "Parent cache open cache handler" << dendl; - m_object_store = new SharedPersistentObjectCacher(m_image_ctx, m_image_ctx->shared_cache_path); + m_object_store = new SharedPersistentObjectCacher(m_image_ctx); } return 0; } @@ -200,8 +200,7 @@ int ParentCacheObjectDispatch::create_cache_session(Context* on_finish, bool template ParentCacheObjectDispatch::SharedPersistentObjectCacher::SharedPersistentObjectCacher ( - I *image_ctx, std::string cache_path) - : m_image_ctx(image_ctx) { + I *image_ctx) : m_image_ctx(image_ctx) { auto *cct = m_image_ctx->cct; ldout(cct, 20) << dendl; } diff --git a/src/librbd/cache/ParentCacheObjectDispatch.h b/src/librbd/cache/ParentCacheObjectDispatch.h index d7b6403a93a..d4efda77d43 100644 --- a/src/librbd/cache/ParentCacheObjectDispatch.h +++ b/src/librbd/cache/ParentCacheObjectDispatch.h @@ -122,7 +122,7 @@ private: class SharedPersistentObjectCacher { public: - SharedPersistentObjectCacher(ImageCtxT *image_ctx, std::string cache_path); + SharedPersistentObjectCacher(ImageCtxT *image_ctx); ~SharedPersistentObjectCacher(); int read_object(std::string file_path, ceph::bufferlist* read_data, diff --git a/src/librbd/image/OpenRequest.cc b/src/librbd/image/OpenRequest.cc index 83d94cf36b9..cba70212302 100644 --- a/src/librbd/image/OpenRequest.cc +++ b/src/librbd/image/OpenRequest.cc @@ -523,7 +523,9 @@ Context *OpenRequest::send_init_cache(int *result) { if (!m_image_ctx->cache || m_image_ctx->child != nullptr) { // enable Shared Read-only cache for parent image - if (m_image_ctx->child != nullptr && m_image_ctx->parent_cache_enabled ) { + bool parent_cache_enabled = m_image_ctx->config.template get_val( + "rbd_parent_cache_enabled"); + if (m_image_ctx->child != nullptr && parent_cache_enabled ) { ldout(cct, 10) << this << " " << "setting up parent cache"<< dendl; auto sro_cache = cache::ParentCacheObjectDispatch::create(m_image_ctx); sro_cache->init();