diff options
author | Vladimir Sementsov-Ogievskiy | 2020-09-24 21:40:01 +0200 |
---|---|---|
committer | Stefan Hajnoczi | 2020-10-23 14:42:16 +0200 |
commit | 624f27bbe9615ba7a763ccc4632a4df5f0721fd0 (patch) | |
tree | 4fd38276a154be829a72d548f6bd343a9eed7870 /block | |
parent | block/io: bdrv_common_block_status_above: support include_base (diff) | |
download | qemu-624f27bbe9615ba7a763ccc4632a4df5f0721fd0.tar.gz qemu-624f27bbe9615ba7a763ccc4632a4df5f0721fd0.tar.xz qemu-624f27bbe9615ba7a763ccc4632a4df5f0721fd0.zip |
block/io: bdrv_common_block_status_above: support bs == base
We are going to reuse bdrv_common_block_status_above in
bdrv_is_allocated_above. bdrv_is_allocated_above may be called with
include_base == false and still bs == base (for ex. from img_rebase()).
So, support this corner case.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-id: 20200924194003.22080-4-vsementsov@virtuozzo.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/io.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/block/io.c b/block/io.c index 86f76d04bf..b616bc4ada 100644 --- a/block/io.c +++ b/block/io.c @@ -2355,9 +2355,13 @@ bdrv_co_common_block_status_above(BlockDriverState *bs, BlockDriverState *p; int64_t eof = 0; - assert(include_base || bs != base); assert(!include_base || base); /* Can't include NULL base */ + if (!include_base && bs == base) { + *pnum = bytes; + return 0; + } + ret = bdrv_co_block_status(bs, want_zero, offset, bytes, pnum, map, file); if (ret < 0 || *pnum == 0 || ret & BDRV_BLOCK_ALLOCATED || bs == base) { return ret; |