[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 3/5] block/io: bdrv_common_block_status_above: support bs == b
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v2 3/5] block/io: bdrv_common_block_status_above: support bs == base |
Date: |
Tue, 19 May 2020 22:54:59 +0300 |
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 <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
block/io.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/io.c b/block/io.c
index cdc0e6663e..df44e89b7d 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2458,7 +2458,11 @@ static int coroutine_fn
bdrv_co_block_status_above(BlockDriverState *bs,
int ret = 0;
bool first = true;
- assert(include_base || bs != base);
+ if (!include_base && bs == base) {
+ *pnum = bytes;
+ return 0;
+ }
+
for (p = bs; include_base || p != base; p = backing_bs(p)) {
ret = bdrv_co_block_status(p, want_zero, offset, bytes, pnum, map,
file);
--
2.21.0
Re: [PATCH v2 0/5] fix & merge block_status_above and is_allocated_above, Eric Blake, 2020/05/19