From: Josh Durgin Date: Fri, 10 May 2013 22:45:57 +0000 (-0700) Subject: librbd: move completion release into rbd_ctx_cb() X-Git-Tag: v0.63~39^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb299d3819f6469c3eecd73efe8cc32ad868628e;p=ceph.git librbd: move completion release into rbd_ctx_cb() 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 --- diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 80e07ed102fa..21711ae19fc2 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2243,6 +2243,7 @@ reprotect_and_return_err: Context *ctx = reinterpret_cast(arg); AioCompletion *comp = reinterpret_cast(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; diff --git a/src/librbd/internal.h b/src/librbd/internal.h index 4b46594cc913..a7d39b3c964b 100644 --- a/src/librbd/internal.h +++ b/src/librbd/internal.h @@ -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