]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: make cache watermark configurable
authorshangdehao1 <dehao.shang@intel.com>
Thu, 7 Mar 2019 00:06:12 +0000 (08:06 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Thu, 21 Mar 2019 16:16:30 +0000 (00:16 +0800)
Signed-off-by: Dehao Shang <dehao.shang@intel.com>
src/common/options.cc
src/tools/immutable_object_cache/ObjectCacheStore.cc
src/tools/immutable_object_cache/ObjectCacheStore.h

index 59ed0e7f429c52aaec1e4702156b23af535158f1..3a3c3be5a0b4534ddacd85451368579352c2b850 100644 (file)
@@ -7409,6 +7409,10 @@ static std::vector<Option> get_immutable_object_cache_options() {
     Option("immutable_object_cache_client_dedicated_thread_num", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(2)
     .set_description("immutable object cache client dedicated thread number"),
+
+    Option("immutable_object_cache_watermark", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
+    .set_default(0.1)
+    .set_description("immutable object cache water mark"),
   });
 }
 
index f0b6eb1a5ab90d22e47960c296438d0c8e759c13..df73bd3b1f14f06af7c8df9164de531b292e211a 100644 (file)
@@ -19,18 +19,21 @@ namespace immutable_obj_cache {
 ObjectCacheStore::ObjectCacheStore(CephContext *cct)
       : m_cct(cct), m_rados(new librados::Rados()),
         m_ioctx_map_lock("ceph::cache::ObjectCacheStore::m_ioctx_map_lock") {
-  object_cache_max_size =
+  m_object_cache_max_size =
     m_cct->_conf.get_val<Option::size_t>("immutable_object_cache_max_size");
 
   m_cache_root_dir =
     m_cct->_conf.get_val<std::string>("immutable_object_cache_path");
 
+  m_cache_watermark =
+    m_cct->_conf.get_val<double>("immutable_object_cache_watermark");
+
   if (m_cache_root_dir.back() != '/') {
     m_cache_root_dir += "/";
   }
 
-  // TODO(dehao): allow to set cache level
-  m_policy = new SimplePolicy(m_cct, object_cache_max_size, 0.1);
+  m_policy = new SimplePolicy(m_cct, m_object_cache_max_size,
+                              m_cache_watermark);
 }
 
 ObjectCacheStore::~ObjectCacheStore() {
index fa86aca4032cc823a2c6d48629fb4fab2c4c0802..2972f52a3e1aa2a07b8ba5ab540a5903ff39f045 100644 (file)
@@ -53,7 +53,8 @@ class ObjectCacheStore {
   Policy* m_policy;
   // TODO(dehao): make this configurable
   int m_dir_num = 10;
-  uint64_t object_cache_max_size;
+  uint64_t m_object_cache_max_size;
+  float m_cache_watermark;
   std::string m_cache_root_dir;
 };