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>
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;