From: Jason Dillaman Date: Wed, 6 May 2020 14:52:58 +0000 (-0400) Subject: librbd: complete ImageDispatchSpec upon AioCompletion finalization X-Git-Tag: v16.1.0~2318^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b0b95771fa6485a096fd45ccb89fb551789a37fa;p=ceph.git librbd: complete ImageDispatchSpec upon AioCompletion finalization This will allow ImageDispatchSpec to invoke any necessary finalizers for the different dispatch layers and allows in-flight IO to be tracked since the image dispatch layer finalizers won't be invoked until after the AioCompletion fires. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/io/AioCompletion.cc b/src/librbd/io/AioCompletion.cc index afd4a30d7688..9ebb334a2b15 100644 --- a/src/librbd/io/AioCompletion.cc +++ b/src/librbd/io/AioCompletion.cc @@ -116,6 +116,10 @@ void AioCompletion::complete() { cond.notify_all(); } + if (image_dispatcher_ctx != nullptr) { + image_dispatcher_ctx->complete(rval); + } + // note: possible for image to be closed after op marked finished if (async_op.started()) { async_op.finish_op(); diff --git a/src/librbd/io/AioCompletion.h b/src/librbd/io/AioCompletion.h index 9df547cd2413..43ef32465977 100644 --- a/src/librbd/io/AioCompletion.h +++ b/src/librbd/io/AioCompletion.h @@ -19,11 +19,11 @@ #include #include +struct Context; namespace librbd { namespace io { - /** * AioCompletion is the overall completion for a single * rbd I/O request. It may be composed of many AioObjectRequests, @@ -72,6 +72,8 @@ struct AioCompletion { bool was_armed = false; bool external_callback = false; + Context* image_dispatcher_ctx = nullptr; + template static void callback_adapter(completion_t cb, void *arg) { AioCompletion *comp = reinterpret_cast(cb);