From patchwork Wed May 6 14:04:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 468951 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 7DDD3140134 for ; Thu, 7 May 2015 00:07:05 +1000 (AEST) Received: from localhost ([::1]:45306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpzyZ-0007ZA-Jn for incoming@patchwork.ozlabs.org; Wed, 06 May 2015 10:07:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypzvm-0002pd-Sm for qemu-devel@nongnu.org; Wed, 06 May 2015 10:04:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ypzvh-0002Dp-Ab for qemu-devel@nongnu.org; Wed, 06 May 2015 10:04:10 -0400 Received: from mail.ispras.ru ([83.149.199.45]:49069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypzvh-0002Df-35 for qemu-devel@nongnu.org; Wed, 06 May 2015 10:04:05 -0400 Received: from [10.10.150.102] (unknown [85.142.117.224]) by mail.ispras.ru (Postfix) with ESMTPSA id 49A7E540070; Wed, 6 May 2015 17:04:04 +0300 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Wed, 06 May 2015 17:04:07 +0300 Message-ID: <20150506140406.17288.85396.stgit@PASHA-ISP> In-Reply-To: <20150506140238.17288.87548.stgit@PASHA-ISP> References: <20150506140238.17288.87548.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, 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 Subject: [Qemu-devel] [RFC PATCH v13 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 | 8 +++++++- include/block/aio.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/async.c b/async.c index 46d9e63..734c76c 100644 --- a/async.c +++ b/async.c @@ -59,6 +59,12 @@ QEMUBH *aio_bh_new(AioContext *ctx, QEMUBHFunc *cb, void *opaque) return bh; } +void aio_bh_call(void *opaque) +{ + QEMUBH *bh = (QEMUBH *)opaque; + bh->cb(bh->opaque); +} + /* Multiple occurrences of aio_bh_poll cannot be called concurrently */ int aio_bh_poll(AioContext *ctx) { @@ -82,7 +88,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..b498704 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(void *opaque); + +/** * aio_bh_poll: Poll bottom halves for an AioContext. * * These are internal functions used by the QEMU main loop.