From patchwork Wed Jul 1 11:53:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 490110 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 29E9C1402A2 for ; Wed, 1 Jul 2015 22:07:30 +1000 (AEST) Received: from localhost ([::1]:57602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAGnY-00045x-87 for incoming@patchwork.ozlabs.org; Wed, 01 Jul 2015 08:07:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAGZX-0005kE-E9 for qemu-devel@nongnu.org; Wed, 01 Jul 2015 07:53:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAGZW-0008Bc-GC for qemu-devel@nongnu.org; Wed, 01 Jul 2015 07:52:59 -0400 Received: from mail.ispras.ru ([83.149.199.45]:54328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAGZW-0008BW-7e for qemu-devel@nongnu.org; Wed, 01 Jul 2015 07:52:58 -0400 Received: from [10.10.150.7] (unknown [85.142.117.224]) by mail.ispras.ru (Postfix) with ESMTPSA id 5097154016E; Wed, 1 Jul 2015 14:52:57 +0300 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Wed, 01 Jul 2015 14:53:00 +0300 Message-ID: <20150701115300.9832.51141.stgit@PASHA-ISP> In-Reply-To: <20150701115132.9832.12257.stgit@PASHA-ISP> References: <20150701115132.9832.12257.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, igor.rubinov@gmail.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, hines@cert.org, fred.konrad@greensocs.com Subject: [Qemu-devel] [PATCH v15 15/21] bottom halves: introduce bh call function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 77d080d..7584b7e 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 b46103e..0ec711f 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.