]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools: make cache file dir number configurable
authorshangdehao1 <dehao.shang@intel.com>
Thu, 7 Mar 2019 00:31:29 +0000 (08:31 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Thu, 21 Mar 2019 16:16:31 +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 3a3c3be5a0b4534ddacd85451368579352c2b850..e6a4d507cceec03f0a05e4f304758ef69f3ebcb2 100644 (file)
@@ -7413,6 +7413,10 @@ static std::vector<Option> get_immutable_object_cache_options() {
     Option("immutable_object_cache_watermark", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
     .set_default(0.1)
     .set_description("immutable object cache water mark"),
+
+    Option("immutable_object_cache_dir_num", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    .set_default(10)
+    .set_description("immutable object cache dir number"),
   });
 }
 
index df73bd3b1f14f06af7c8df9164de531b292e211a..2ca431dbb3916e6ff228e323e9a1c4bf543a5efb 100644 (file)
@@ -28,6 +28,9 @@ ObjectCacheStore::ObjectCacheStore(CephContext *cct)
   m_cache_watermark =
     m_cct->_conf.get_val<double>("immutable_object_cache_watermark");
 
+  m_dir_num =
+    m_cct->_conf.get_val<uint64_t>("immutable_object_cache_dir_num");
+
   if (m_cache_root_dir.back() != '/') {
     m_cache_root_dir += "/";
   }
@@ -233,6 +236,7 @@ int ObjectCacheStore::evict_objects() {
   for (auto& obj : obj_list) {
     do_evict(obj);
   }
+  return 0;
 }
 
 int ObjectCacheStore::do_evict(std::string cache_file) {
index 2972f52a3e1aa2a07b8ba5ab540a5903ff39f045..7176fdfa4130dfe06f1bc67617404778f0f8ad8c 100644 (file)
@@ -51,8 +51,7 @@ class ObjectCacheStore {
   std::map<uint64_t, librados::IoCtx> m_ioctx_map;
   Mutex m_ioctx_map_lock;
   Policy* m_policy;
-  // TODO(dehao): make this configurable
-  int m_dir_num = 10;
+  uint64_t m_dir_num;
   uint64_t m_object_cache_max_size;
   float m_cache_watermark;
   std::string m_cache_root_dir;