From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:52519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTEJG-0006ce-1B for qemu-devel@nongnu.org; Wed, 23 Nov 2011 10:00:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTEJA-00028J-8s for qemu-devel@nongnu.org; Wed, 23 Nov 2011 10:00:26 -0500 Received: from mtagate1.uk.ibm.com ([194.196.100.161]:53962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTEJ9-00027a-QQ for qemu-devel@nongnu.org; Wed, 23 Nov 2011 10:00:20 -0500 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id pANF0FgP021092 for ; Wed, 23 Nov 2011 15:00:15 GMT Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pANF0EpQ2662562 for ; Wed, 23 Nov 2011 15:00:14 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 pANF0EsV008413 for ; Wed, 23 Nov 2011 08:00:14 -0700 From: Stefan Hajnoczi Date: Wed, 23 Nov 2011 15:00:04 +0000 Message-Id: <1322060404-15494-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2] cow: use bdrv_co_is_allocated() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi Now that bdrv_co_is_allocated() is available we can use it instead of the synchronous bdrv_is_allocated() interface. This is a follow-up that Kevin Wolf pointed out after applying the series that introduces bdrv_co_is_allocated(). It is safe to make cow_read() a coroutine_fn because its only caller is a coroutine_fn. Signed-off-by: Stefan Hajnoczi --- block/cow.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/cow.c b/block/cow.c index 7ae887b..586493c 100644 --- a/block/cow.c +++ b/block/cow.c @@ -171,14 +171,14 @@ static int cow_update_bitmap(BlockDriverState *bs, int64_t sector_num, return error; } -static int cow_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) +static int coroutine_fn cow_read(BlockDriverState *bs, int64_t sector_num, + uint8_t *buf, int nb_sectors) { BDRVCowState *s = bs->opaque; int ret, n; while (nb_sectors > 0) { - if (bdrv_is_allocated(bs, sector_num, nb_sectors, &n)) { + if (bdrv_co_is_allocated(bs, sector_num, nb_sectors, &n)) { ret = bdrv_pread(bs->file, s->cow_sectors_offset + sector_num * 512, buf, n * 512); -- 1.7.7.1