]> Git Repo - qemu.git/commitdiff
cow: use bdrv_co_is_allocated()
authorStefan Hajnoczi <[email protected]>
Wed, 23 Nov 2011 15:00:04 +0000 (15:00 +0000)
committerKevin Wolf <[email protected]>
Mon, 5 Dec 2011 13:51:38 +0000 (14:51 +0100)
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 <[email protected]> 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 <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/cow.c

index 7ae887b670b1f55043dc1dc179131a14a6298888..586493c62345c8fd3c0d7c5432035871bc9022a9 100644 (file)
@@ -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);
This page took 0.022604 seconds and 4 git commands to generate.