diff mbox

[v16,15/21] bottom halves: introduce bh call function

Message ID 20150804084514.7280.95195.stgit@PASHA-ISP
State New
Headers show

Commit Message

Pavel Dovgalyuk Aug. 4, 2015, 8:45 a.m. UTC
This patch introduces aio_bh_call function. It is used to execute
bottom halves as callbacks without adding them to the queue.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
 async.c             |    7 ++++++-
 include/block/aio.h |    5 +++++
 2 files changed, 11 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/async.c b/async.c
index efce14b..e1db2dc 100644
--- a/async.c
+++ b/async.c
@@ -59,6 +59,11 @@  QEMUBH *aio_bh_new(AioContext *ctx, QEMUBHFunc *cb, void *opaque)
     return bh;
 }
 
+void aio_bh_call(QEMUBH *bh)
+{
+    bh->cb(bh->opaque);
+}
+
 /* Multiple occurrences of aio_bh_poll cannot be called concurrently */
 int aio_bh_poll(AioContext *ctx)
 {
@@ -84,7 +89,7 @@  int aio_bh_poll(AioContext *ctx)
                 ret = 1;
             }
             bh->idle = 0;
-            bh->cb(bh->opaque);
+            aio_bh_call(bh);
         }
     }
 
diff --git a/include/block/aio.h b/include/block/aio.h
index 400b1b0..7c31b19 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -207,6 +207,11 @@  void aio_notify(AioContext *ctx);
 void aio_notify_accept(AioContext *ctx);
 
 /**
+ * aio_bh_call: Executes callback function of the specified BH.
+ */
+void aio_bh_call(QEMUBH *bh);
+
+/**
  * aio_bh_poll: Poll bottom halves for an AioContext.
  *
  * These are internal functions used by the QEMU main loop.