diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-09-04 19:00:30 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-09-06 15:25:09 +0200 |
commit | 4bc74be997a72922170f4f272fd5e8074a3ecc27 (patch) | |
tree | c3b466014f752398a8b9543e99da0651bb12c759 /block/cow.c | |
parent | 4333bb71405f58a8dc8d3255feb3ca5960b0daf8 (diff) | |
download | hqemu-4bc74be997a72922170f4f272fd5e8074a3ecc27.zip hqemu-4bc74be997a72922170f4f272fd5e8074a3ecc27.tar.gz |
block: return get_block_status data and flags for formats
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/cow.c')
-rw-r--r-- | block/cow.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/block/cow.c b/block/cow.c index d4b8c6b..764b93f 100644 --- a/block/cow.c +++ b/block/cow.c @@ -191,7 +191,13 @@ static int coroutine_fn cow_co_is_allocated(BlockDriverState *bs, static int64_t coroutine_fn cow_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *num_same) { - return cow_co_is_allocated(bs, sector_num, nb_sectors, num_same); + BDRVCowState *s = bs->opaque; + int ret = cow_co_is_allocated(bs, sector_num, nb_sectors, num_same); + int64_t offset = s->cow_sectors_offset + (sector_num << BDRV_SECTOR_BITS); + if (ret < 0) { + return ret; + } + return (ret ? BDRV_BLOCK_DATA : 0) | offset | BDRV_BLOCK_OFFSET_VALID; } static int cow_update_bitmap(BlockDriverState *bs, int64_t sector_num, |