]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: remove parent cache config from ImageCtx
authorshangdehao1 <dehao.shang@intel.com>
Mon, 10 Jun 2019 01:19:36 +0000 (09:19 +0800)
committerJason Dillaman <dillaman@redhat.com>
Mon, 24 Jun 2019 21:36:54 +0000 (17:36 -0400)
Signed-off-by: Dehao Shang <dehao.shang@intel.com>
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/cache/ParentCacheObjectDispatch.cc
src/librbd/cache/ParentCacheObjectDispatch.h
src/librbd/image/OpenRequest.cc

index 2772c836e2bdb348bd35d6f96d7c1cfb2563fe90..5a8bf337745a7954f1d6bb8d27e530b87de23d47 100644 (file)
@@ -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
 
index 7864e9a157c642a705ab9c1b64ecf829f4c53469..32f5f5f2b965558427502dfa80adee1c9702c5ce 100644 (file)
@@ -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;
index b6428b193bf49aa10f25daea855544ff14f4b04f..cafbd5c2c730ec4865d74abe42b8e1896ecf0d7d 100644 (file)
@@ -146,7 +146,7 @@ int ParentCacheObjectDispatch<I>::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<I>::create_cache_session(Context* on_finish, bool
 
 template <typename I>
 ParentCacheObjectDispatch<I>::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;
 }
index d7b6403a93a8f3f391edc8cea2dbbd3545bdd277..d4efda77d431c07720db88260a0c3a7d72abd59e 100644 (file)
@@ -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,
index 83d94cf36b9ec4d00884c2cebfea16bdc40740fc..cba70212302fb74745d127c665987a70e5c58688 100644 (file)
@@ -523,7 +523,9 @@ Context *OpenRequest<I>::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<bool>(
+      "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<I>::create(m_image_ctx);
       sro_cache->init();