Skip to contentSkip to conversation

cow: use bdrv_co_is_allocated()

PATCH Applied Stefan Hajnoczi 2 participants 2 messages Nov 23, 2011 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 <[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.

---
 block/cow.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
block/cow.c +3 -3
index 7ae887b..586493c 100644
@@ -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);
Signature · 1 line
1.7.7.1
Applied
#1 lore raw

Am 23.11.2011 16:00, schrieb Stefan Hajnoczi:

Quoted 9 lines

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.

Thanks, applied to the block branch (for 1.1)

Kevin