[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 28/30] block/io: bdrv_common_block_status_above: support bs ==
From: |
Stefan Hajnoczi |
Subject: |
[PULL v2 28/30] block/io: bdrv_common_block_status_above: support bs == base |
Date: |
Mon, 12 Oct 2020 19:27:58 +0100 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
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>
---
block/io.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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;
--
2.26.2
- [PULL v2 20/30] util/vhost-user-server: use static library in meson.build, (continued)
- [PULL v2 20/30] util/vhost-user-server: use static library in meson.build, Stefan Hajnoczi, 2020/10/12
- [PULL v2 21/30] qemu-storage-daemon: avoid compiling blockdev_ss twice, Stefan Hajnoczi, 2020/10/12
- [PULL v2 22/30] block: move block exports to libblockdev, Stefan Hajnoczi, 2020/10/12
- [PULL v2 23/30] block/export: add iothread and fixed-iothread options, Stefan Hajnoczi, 2020/10/12
- [PULL v2 24/30] block/export: add vhost-user-blk multi-queue support, Stefan Hajnoczi, 2020/10/12
- [PULL v2 25/30] tests/qtest: add multi-queue test case to vhost-user-blk-test, Stefan Hajnoczi, 2020/10/12
- [PULL v2 26/30] block/io: fix bdrv_co_block_status_above, Stefan Hajnoczi, 2020/10/12
- [PULL v2 27/30] block/io: bdrv_common_block_status_above: support include_base, Stefan Hajnoczi, 2020/10/12
- [PULL v2 29/30] block/io: fix bdrv_is_allocated_above, Stefan Hajnoczi, 2020/10/12
- [PULL v2 30/30] iotests: add commit top->base cases to 274, Stefan Hajnoczi, 2020/10/12
- [PULL v2 28/30] block/io: bdrv_common_block_status_above: support bs == base,
Stefan Hajnoczi <=
- Re: [PULL v2 00/30] Block patches, no-reply, 2020/10/12
- Re: [PULL v2 00/30] Block patches, Peter Maydell, 2020/10/12