From patchwork Tue Oct 27 14:09:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 536637 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 B57CE14076E for ; Wed, 28 Oct 2015 01:11:10 +1100 (AEDT) Received: from localhost ([::1]:59857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr4xw-0004H7-DJ for incoming@patchwork.ozlabs.org; Tue, 27 Oct 2015 10:11:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr4x0-0002wZ-Fy for qemu-devel@nongnu.org; Tue, 27 Oct 2015 10:10:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zr4wv-0008C4-MH for qemu-devel@nongnu.org; Tue, 27 Oct 2015 10:10:10 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:23185 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr4wk-00087F-F6; Tue, 27 Oct 2015 10:09:54 -0400 Received: from hades.sw.ru ([10.30.8.132]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id t9RE9k9n015417; Tue, 27 Oct 2015 17:09:51 +0300 (MSK) From: "Denis V. Lunev" To: Date: Tue, 27 Oct 2015 17:09:43 +0300 Message-Id: <1445954986-13005-3-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445954986-13005-1-git-send-email-den@openvz.org> References: <1445954986-13005-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: "Denis V. Lunev" , Paolo Bonzini , qemu-devel@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 2/5] aio_context: create aio_context_is_locked helper 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 helper is necessary to ensure locking constraints. Signed-off-by: Denis V. Lunev CC: Stefan Hajnoczi CC: Paolo Bonzini --- async.c | 5 +++++ include/block/aio.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/async.c b/async.c index bdc64a3..4a9250e 100644 --- a/async.c +++ b/async.c @@ -361,3 +361,8 @@ void aio_context_release(AioContext *ctx) { rfifolock_unlock(&ctx->lock); } + +int aio_context_is_locked(AioContext *ctx) +{ + return rfifolock_is_locked(&ctx->lock); +} diff --git a/include/block/aio.h b/include/block/aio.h index bcc7d43..d20c7b8 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -166,6 +166,9 @@ void aio_context_acquire(AioContext *ctx); /* Relinquish ownership of the AioContext. */ void aio_context_release(AioContext *ctx); +/* Check that AioContext is locked by the caller. */ +int aio_context_is_locked(AioContext *ctx); + /** * aio_bh_new: Allocate a new bottom half structure. *