From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwrBa-0005tS-7X for qemu-devel@nongnu.org; Mon, 25 May 2015 08:08:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwrBT-0006RW-Kp for qemu-devel@nongnu.org; Mon, 25 May 2015 08:08:50 -0400 Received: from mail.ispras.ru ([83.149.199.45]:39348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwrBT-0006RR-Dp for qemu-devel@nongnu.org; Mon, 25 May 2015 08:08:43 -0400 From: Pavel Dovgalyuk Date: Mon, 25 May 2015 15:08:42 +0300 Message-ID: <20150525120841.1052.85666.stgit@PASHA-ISP> In-Reply-To: <20150525120707.1052.44580.stgit@PASHA-ISP> References: <20150525120707.1052.44580.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v14 15/21] bottom halves: introduce bh call function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, fred.konrad@greensocs.com 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 --- async.c | 7 ++++++- include/block/aio.h | 5 +++++ 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/async.c b/async.c index 46d9e63..be849bf 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) { @@ -82,7 +87,7 @@ int aio_bh_poll(AioContext *ctx) if (!bh->idle) 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 d2bb423..5c7c4ab 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -157,6 +157,11 @@ QEMUBH *aio_bh_new(AioContext *ctx, QEMUBHFunc *cb, void *opaque); void aio_notify(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.