]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/cache/pwl: Rename config options 38864/head
authorMahati Chamarthy <mahati.chamarthy@intel.com>
Tue, 12 Jan 2021 08:08:02 +0000 (13:38 +0530)
committerMahati Chamarthy <mahati.chamarthy@intel.com>
Wed, 13 Jan 2021 07:55:26 +0000 (13:25 +0530)
Signed-off-by: Mahati Chamarthy <mahati.chamarthy@intel.com>
src/common/options.cc
src/librbd/cache/pwl/AbstractWriteLog.cc
src/librbd/cache/pwl/ImageCacheState.cc
src/librbd/plugin/WriteLogImageCache.cc
src/test/librbd/cache/pwl/test_mock_ReplicatedWriteLog.cc
src/test/librbd/cache/pwl/test_mock_SSDWriteLog.cc
src/test/librbd/test_fixture.cc

index 74e0378ad1489b1089176f9ea01f8c3eaeaf417b..ffb3083851567e4d7eb90e0d20b0a8d1f17eb289 100644 (file)
@@ -7734,16 +7734,16 @@ static std::vector<Option> get_rbd_options() {
     .set_enum_allowed({"disabled", "rwl", "ssd"})
     .set_description("enable persistent write back cache for this volume"),
 
-    Option("rbd_rwl_log_periodic_stats", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    Option("rbd_persistent_cache_log_periodic_stats", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
     .set_default(false)
     .set_description("emit periodic perf stats to debug log"),
 
-    Option("rbd_rwl_size", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    Option("rbd_persistent_cache_size", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(1073741824)
     .set_min(1073741824)
     .set_description("size of the persistent write back cache for this volume"),
 
-    Option("rbd_rwl_path", Option::TYPE_STR, Option::LEVEL_ADVANCED)
+    Option("rbd_persistent_cache_path", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("/tmp")
     .set_description("location of the persistent write back cache in a DAX-enabled filesystem on persistent memory"),
 
index 987f5258df8cceb3ccc2332c9b4dbae09726cefb..9a15b05788a1dcf252068bd988be259a65580447 100644 (file)
@@ -496,9 +496,11 @@ void AbstractWriteLog<I>::pwl_init(Context *on_finish, DeferredContexts &later)
 
   if (!m_cache_state->present) {
     m_cache_state->host = ceph_get_short_hostname();
-    m_cache_state->size = m_image_ctx.config.template get_val<uint64_t>("rbd_rwl_size");
+    m_cache_state->size = m_image_ctx.config.template get_val<uint64_t>(
+        "rbd_persistent_cache_size");
 
-    string path = m_image_ctx.config.template get_val<string>("rbd_rwl_path");
+    string path = m_image_ctx.config.template get_val<string>(
+        "rbd_persistent_cache_path");
     std::string pool_name = m_image_ctx.md_ctx.get_pool_name();
     m_cache_state->path = path + "/rbd-pwl." + pool_name + "." + m_image_ctx.id + ".pool";
   }
index 4320024b316daac8fc35b34602be579aa5f2ca40..2c6117d9e2ff3bd8ec73725e866555b09b264458 100644 (file)
@@ -40,7 +40,7 @@ ImageCacheState<I>::ImageCacheState(I *image_ctx, plugin::Api<I>& plugin_api) :
                             << dendl;
 
   ConfigProxy &config = image_ctx->config;
-  log_periodic_stats = config.get_val<bool>("rbd_rwl_log_periodic_stats");
+  log_periodic_stats = config.get_val<bool>("rbd_persistent_cache_log_periodic_stats");
   cache_type = config.get_val<std::string>("rbd_persistent_cache_mode");
 }
 
@@ -63,7 +63,7 @@ ImageCacheState<I>::ImageCacheState(
 
   // Others from config
   ConfigProxy &config = image_ctx->config;
-  log_periodic_stats = config.get_val<bool>("rbd_rwl_log_periodic_stats");
+  log_periodic_stats = config.get_val<bool>("rbd_persistent_cache_log_periodic_stats");
 }
 
 template <typename I>
index 2a32841f4b423fb7bceb0febd71e8acb8ccff3e9..308bb6a00ad3318be08e91f02f9d6a83464b4be8 100644 (file)
@@ -8,6 +8,7 @@
 #include "librbd/ImageCtx.h"
 #include "librbd/cache/WriteLogImageDispatch.h"
 #include "librbd/cache/ImageWriteback.h"
+#include "librbd/cache/Utils.h"
 #include "librbd/cache/pwl/DiscardRequest.h"
 #include "librbd/cache/pwl/InitRequest.h"
 #include "librbd/io/ImageDispatcherInterface.h"
@@ -41,9 +42,8 @@ void WriteLogImageCache<I>::init(I* image_ctx, Api<I>& api,
                                  cache::ImageWritebackInterface& image_writeback,
                                  PluginHookPoints& hook_points_list,
                                  Context* on_finish) {
-  bool rwl_enabled = image_ctx->config.template get_val<bool>(
-    "rbd_rwl_enabled");
-  if (!rwl_enabled || !image_ctx->data_ctx.is_valid()) {
+  bool pwl_enabled = librbd::cache::util::is_pwl_enabled(*image_ctx);
+  if (!pwl_enabled || !image_ctx->data_ctx.is_valid()) {
     on_finish->complete(0);
     return;
   }
index 77faee08f3b10747c091f8751244cb4306a176c8..e01f1b585e45d511dde419b2608923ec399ad2ad 100644 (file)
@@ -83,7 +83,7 @@ struct TestMockCacheReplicatedWriteLog : public TestMockFixture {
     ASSERT_EQ(host, state.host);
     ASSERT_EQ(path, state.path);
     ASSERT_EQ(size, state.size);
-    ASSERT_EQ(config.get_val<bool>("rbd_rwl_log_periodic_stats"),
+    ASSERT_EQ(config.get_val<bool>("rbd_persistent_cache_log_periodic_stats"),
              state.log_periodic_stats);
   }
 
index 22a9dcb1d0607d97a270594a0d1ecdde6b8a8e86..63eebd0c28d4541b2cfb029c545b66c128bd87bc 100644 (file)
@@ -85,7 +85,7 @@ struct TestMockCacheSSDWriteLog : public TestMockFixture {
     ASSERT_EQ(host, state.host);
     ASSERT_EQ(path, state.path);
     ASSERT_EQ(size, state.size);
-    ASSERT_EQ(config.get_val<bool>("rbd_rwl_log_periodic_stats"),
+    ASSERT_EQ(config.get_val<bool>("rbd_persistent_cache_log_periodic_stats"),
              state.log_periodic_stats);
   }
 
index ba55e0a20568d51c9dc38932482e9778dc167ca9..9ddebec482ef6722fb683fcb1ecfc6497910a432 100644 (file)
@@ -62,7 +62,7 @@ void TestFixture::SetUp() {
   ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), m_ioctx));
   m_cct = reinterpret_cast<CephContext*>(m_ioctx.cct());
   librados::Rados rados(m_ioctx);
-  rados.conf_set("rbd_rwl_path", ".");
+  rados.conf_set("rbd_persistent_cache_path", ".");
 
   m_image_name = get_temp_image_name();
   m_image_size = 2 << 20;