]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: refine hard code and remove dead code
authorshangdehao1 <dehao.shang@intel.com>
Wed, 12 Jun 2019 22:04:30 +0000 (06:04 +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/cache/ParentCacheObjectDispatch.cc
src/test/immutable_object_cache/test_DomainSocket.cc

index 65e55927da20ef5f52a7912433045cbbf4cf2ed8..a6a00def13f68976919bab482cfaa49201d83060 100644 (file)
@@ -168,14 +168,11 @@ int ParentCacheObjectDispatch<I>::create_cache_session(Context* on_finish, bool
   Context* register_ctx = new FunctionContext([this, cct, on_finish](int ret) {
     if (ret < 0) {
       lderr(cct) << "Parent cache fail to register client." << dendl;
-      handle_register_client(false);
-      on_finish->complete(-1);
-      return;
+    } else {
+      ceph_assert(m_cache_client->is_session_work());
     }
-    ceph_assert(m_cache_client->is_session_work());
-
-    handle_register_client(true);
-    on_finish->complete(0);
+    handle_register_client(ret < 0 ? false : true);
+    on_finish->complete(ret);
   });
 
   Context* connect_ctx = new FunctionContext(
index d1a1aa2cf1b91a8bb3398a71f48e432c7109da87..ad9e79a0bfa3ddf2a74d9819d19f3b7933af9f55 100644 (file)
@@ -130,8 +130,6 @@ public:
 
   bool startup_lookupobject_testing(std::string pool_nspace, std::string object_id) {
     bool hit;
-    //auto ctx = new LambdaGenContext<std::function<void(ObjectCacheRequest*)>,
-    //    ObjectCacheRequest*>([this, &hit](ObjectCacheRequest* ack){
     auto ctx = make_gen_lambda_context<ObjectCacheRequest*, std::function<void(ObjectCacheRequest*)>>
        ([this, &hit](ObjectCacheRequest* ack){
        hit = ack->type == RBDSC_READ_REPLY;