]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: add create_async_context_callback helper
authorMykola Golub <mgolub@mirantis.com>
Sun, 29 Jan 2017 21:07:53 +0000 (22:07 +0100)
committerMykola Golub <mgolub@mirantis.com>
Wed, 1 Feb 2017 09:55:03 +0000 (10:55 +0100)
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
src/librbd/Utils.h

index d03da840726d0aa0b3031bbf56a190c583c46933..c7cf89e973431b3c1301c277c840243d5babcf15 100644 (file)
@@ -156,6 +156,12 @@ Context *create_async_context_callback(I &image_ctx, Context *on_finish) {
       image_ctx.op_work_queue, on_finish);
 }
 
+template <typename WQ>
+Context *create_async_context_callback(WQ *work_queue, Context *on_finish) {
+  // use async callback to acquire a clean lock context
+  return new detail::C_AsyncCallback<WQ>(work_queue, on_finish);
+}
+
 // TODO: temporary until AioCompletion supports templated ImageCtx
 inline ImageCtx *get_image_ctx(ImageCtx *image_ctx) {
   return image_ctx;