]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: move completion release into rbd_ctx_cb()
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 10 May 2013 22:45:57 +0000 (15:45 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Fri, 10 May 2013 23:17:10 +0000 (16:17 -0700)
All the users of rbd_ctx_cb() do this separately right now, but
there's no reason to keep the completion around after the nested
completion has been called. Also declare rbd_ctx_cb() in the header
so it can be used before its definition.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/librbd/internal.cc
src/librbd/internal.h

index 80e07ed102faf34044728d2f4ab01bc36367837e..21711ae19fc262ee8f22678ef93df8de68990cfd 100644 (file)
@@ -2243,6 +2243,7 @@ reprotect_and_return_err:
     Context *ctx = reinterpret_cast<Context *>(arg);
     AioCompletion *comp = reinterpret_cast<AioCompletion *>(cb);
     ctx->complete(comp->get_return_value());
+    comp->release();
   }
 
   int64_t read_iterate(ImageCtx *ictx, uint64_t off, uint64_t len,
@@ -2293,7 +2294,6 @@ reprotect_and_return_err:
        cond.Wait(mylock);
       mylock.Unlock();
 
-      c->release();
       if (ret < 0)
        return ret;
 
@@ -2529,7 +2529,6 @@ reprotect_and_return_err:
       cond.Wait(mylock);
     mylock.Unlock();
 
-    c->release();
     return ret;
   }
 
@@ -2564,7 +2563,6 @@ reprotect_and_return_err:
       cond.Wait(mylock);
     mylock.Unlock();
 
-    c->release();
     if (ret < 0)
       return ret;
 
@@ -2601,7 +2599,6 @@ reprotect_and_return_err:
       cond.Wait(mylock);
     mylock.Unlock();
 
-    c->release();
     if (ret < 0)
       return ret;
 
index 4b46594cc913a58321e67d886708982c3e6da505..a7d39b3c964b67e43dd556276bca741d6865fe97 100644 (file)
@@ -206,6 +206,7 @@ namespace librbd {
   void rados_req_cb(rados_completion_t cb, void *arg);
   void rados_ctx_cb(rados_completion_t cb, void *arg);
   void rbd_req_cb(completion_t cb, void *arg);
+  void rbd_ctx_cb(completion_t cb, void *arg);
 }
 
 #endif