From: Stefan Hajnoczi Date: Wed, 23 Nov 2011 15:00:04 +0000 (+0000) Subject: cow: use bdrv_co_is_allocated() X-Git-Tag: qemu-xen-4.3.0-rc1~1937^2~4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e94d13873334b1880746feca59ce84c0eabc1021;p=qemu-upstream-4.6-testing.git cow: use bdrv_co_is_allocated() 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 --- diff --git a/block/cow.c b/block/cow.c index 7ae887b67..586493c62 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);