Received: from eggs.gnu.org ([140.186.70.92]:46632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXZNi-0001St-8s for qemu-devel@nongnu.org; Mon, 05 Dec 2011 09:19:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXZNd-0000ND-UA for qemu-devel@nongnu.org; Mon, 05 Dec 2011 09:18:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXZNd-0000Mq-3n for qemu-devel@nongnu.org; Mon, 05 Dec 2011 09:18:53 -0500 From: Kevin Wolf Date: Mon, 5 Dec 2011 15:21:14 +0100 Message-Id: <1323094878-7967-38-git-send-email-kwolf@redhat.com> In-Reply-To: <1323094878-7967-1-git-send-email-kwolf@redhat.com> References: <1323094878-7967-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 37/41] cow: use bdrv_co_is_allocated() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: 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 Signed-off-by: Kevin Wolf --- 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.6.4