From patchwork Fri Nov 11 16:47:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 125222 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E91F5B6F80 for ; Sat, 12 Nov 2011 04:05:10 +1100 (EST) Received: from localhost ([::1]:36847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROuHI-0002R3-UE for incoming@patchwork.ozlabs.org; Fri, 11 Nov 2011 11:48:32 -0500 Received: from eggs.gnu.org ([140.186.70.92]:54280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROuGU-0007qL-Ee for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:47:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROuGQ-0000qJ-RC for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:47:42 -0500 Received: from mtagate3.uk.ibm.com ([194.196.100.163]:33869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROuGQ-0000pn-Et for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:47:38 -0500 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id pABGlacI029844 for ; Fri, 11 Nov 2011 16:47:36 GMT Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pABGlZJL2199766 for ; Fri, 11 Nov 2011 16:47:36 GMT Received: from d06av12.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pABGlZ8P006549 for ; Fri, 11 Nov 2011 09:47:35 -0700 Received: from localhost (stefanha-thinkpad.manchester-maybrook.uk.ibm.com [9.174.219.31]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id pABGlZp7006540; Fri, 11 Nov 2011 09:47:35 -0700 From: Stefan Hajnoczi To: Date: Fri, 11 Nov 2011 16:47:19 +0000 Message-Id: <1321030042-20446-8-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.7.1 In-Reply-To: <1321030042-20446-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1321030042-20446-1-git-send-email-stefanha@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 194.196.100.163 Cc: Kevin Wolf , Paolo Bonzini , Marcelo Tosatti , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 07/10] vdi: convert to .bdrv_co_is_allocated() 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 It is trivial to switch from the synchronous .bdrv_is_allocated() interface to .bdrv_co_is_allocated() since vdi_is_allocated() does not block. Signed-off-by: Stefan Hajnoczi --- block/vdi.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index 523a640..1f2bc2c 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -463,8 +463,8 @@ static int vdi_open(BlockDriverState *bs, int flags) return -1; } -static int vdi_is_allocated(BlockDriverState *bs, int64_t sector_num, - int nb_sectors, int *pnum) +static int coroutine_fn vdi_co_is_allocated(BlockDriverState *bs, + int64_t sector_num, int nb_sectors, int *pnum) { /* TODO: Check for too large sector_num (in bdrv_is_allocated or here). */ BDRVVdiState *s = (BDRVVdiState *)bs->opaque; @@ -981,7 +981,7 @@ static BlockDriver bdrv_vdi = { .bdrv_close = vdi_close, .bdrv_create = vdi_create, .bdrv_co_flush = vdi_co_flush, - .bdrv_is_allocated = vdi_is_allocated, + .bdrv_co_is_allocated = vdi_co_is_allocated, .bdrv_make_empty = vdi_make_empty, .bdrv_aio_readv = vdi_aio_readv,