qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 3/5] block/io: bdrv_common_block_status_above: support bs


From: Eric Blake
Subject: Re: [PATCH v3 3/5] block/io: bdrv_common_block_status_above: support bs == base
Date: Wed, 20 May 2020 11:30:11 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 5/20/20 3:35 AM, Vladimir Sementsov-Ogievskiy wrote:
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(-)


Reviewed-by: Eric Blake <address@hidden>

diff --git a/block/io.c b/block/io.c
index ae1c806720..6f90b322f4 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);


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]