]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools: clean up immutable obj cache
authorYuan Zhou <yuan.zhou@intel.com>
Wed, 23 Jan 2019 15:36:57 +0000 (23:36 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Thu, 21 Mar 2019 16:16:28 +0000 (00:16 +0800)
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
src/test/immutable_object_cache/test_object_store.cc
src/tools/immutable_object_cache/CMakeLists.txt
src/tools/immutable_object_cache/CacheController.cc
src/tools/immutable_object_cache/CacheController.h
src/tools/immutable_object_cache/ObjectCacheStore.cc
src/tools/immutable_object_cache/ObjectCacheStore.h

index caa14dc9a1a3231ce60261fe388ddf43cec9495d..e82f42c7ca243c357e6a80699bc571307ba93615 100644 (file)
@@ -54,7 +54,7 @@ public:
     ASSERT_EQ(0, m_test_rados->ioctx_create(m_temp_pool_name.c_str(), m_local_io_ctx));
     m_temp_volume_name = "test_volume";
     m_ceph_context = reinterpret_cast<CephContext*>(m_test_rados->cct());
-    m_object_cache_store = new ObjectCacheStore(m_ceph_context, nullptr);
+    m_object_cache_store = new ObjectCacheStore(m_ceph_context);
   }
 
   void init_object_cache_store(std::string pool_name, std::string vol_name, uint64_t vol_size, bool reset) {
index fa713f639a3eca98dc682df3609f7199043349a5..74362c9a27d59a26b6d370a10aa1135e73833bcf 100644 (file)
@@ -12,16 +12,9 @@ set(ceph_immutable_object_cache_files
 add_library(ceph_immutable_object_cache_lib STATIC ${ceph_immutable_object_cache_files})
 
 add_executable(ceph-immutable-object-cache
-  ObjectCacheFile.cc
-  ObjectCacheStore.cc
-  CacheController.cc
-  CacheServer.cc
-  CacheSession.cc
-  SimplePolicy.cc
-  Utils.cc
-  Types.cc
   main.cc)
 target_link_libraries(ceph-immutable-object-cache
+  ceph_immutable_object_cache_lib
   librados-cxx
   stdc++fs
   global)
index 8e07aea930b342a9bfd77c2cb916a43d58d292dd..9337453381ec87c6a93943941ab4387b0f1c0805 100644 (file)
@@ -25,12 +25,19 @@ CacheController::~CacheController() {
 int CacheController::init() {
   ldout(m_cct, 20) << dendl;
 
-  m_object_cache_store = new ObjectCacheStore(m_cct, pcache_op_work_queue);
+  m_object_cache_store = new ObjectCacheStore(m_cct);
   //TODO(): make this configurable
   int r = m_object_cache_store->init(true);
   if (r < 0) {
     lderr(m_cct) << "init error\n" << dendl;
+    return r;
   }
+
+  r = m_object_cache_store->init_cache();
+  if (r < 0) {
+    lderr(m_cct) << "init error\n" << dendl;
+  }
+
   return r;
 }
 
@@ -65,8 +72,7 @@ void CacheController::handle_request(uint64_t session_id, ObjectCacheRequest* re
 
   switch (req->m_head.type) {
     case RBDSC_REGISTER: {
-      // init cache layout for volume
-      m_object_cache_store->init_cache();
+      // TODO(): skip register and allow clients to lookup directly
       req->m_head.type = RBDSC_REGISTER_REPLY;
       m_cache_server->send(session_id, req);
 
index 4d112c027b52f455bbe594288cd4a9a3847d4142..79b3b9525de1b8e4fd0a1b05c5a1ccd63ab6f328 100644 (file)
@@ -32,7 +32,6 @@ class CacheController {
   std::vector<const char*> m_args;
   CephContext *m_cct;
   ObjectCacheStore *m_object_cache_store;
-  ContextWQ* pcache_op_work_queue;
 };
 
 } // namespace immutable_obj_cache
index 9f27d9f50e7b98efe6d96fba19897c06909cc89e..e50c1da948061979a0e2e60c95ab03629577cc73 100644 (file)
@@ -16,8 +16,8 @@ namespace efs = std::experimental::filesystem;
 namespace ceph {
 namespace immutable_obj_cache {
 
-ObjectCacheStore::ObjectCacheStore(CephContext *cct, ContextWQ* work_queue)
-      : m_cct(cct), m_work_queue(work_queue), m_rados(new librados::Rados()),
+ObjectCacheStore::ObjectCacheStore(CephContext *cct)
+      : m_cct(cct), m_rados(new librados::Rados()),
         m_ioctxs_lock("ceph::cache::ObjectCacheStore::m_ioctxs_lock") {
 
   object_cache_max_size =
index 01bd7d61e3077a0e0fb1fe09e1687ebb79f740fc..f3b14289694e4144e8c3087b4aa80a1ba0aea987 100644 (file)
@@ -25,7 +25,7 @@ typedef shared_ptr<librados::IoCtx> IoCtxRef;
 class ObjectCacheStore
 {
   public:
-    ObjectCacheStore(CephContext *cct, ContextWQ* work_queue);
+    ObjectCacheStore(CephContext *cct);
     ~ObjectCacheStore();
     int init(bool reset);
     int shutdown();
@@ -47,7 +47,6 @@ class ObjectCacheStore
    int do_evict(std::string cache_file);
 
     CephContext *m_cct;
-    ContextWQ* m_work_queue;
     RadosRef m_rados;
     std::map<uint64_t, librados::IoCtx*> m_ioctxs;
     Mutex m_ioctxs_lock;