qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v7 2/5] block/io: bdrv_common_block_status_above: support inc


From: Eric Blake
Subject: Re: [PATCH v7 2/5] block/io: bdrv_common_block_status_above: support include_base
Date: Thu, 24 Sep 2020 15:07:14 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 9/24/20 2:40 PM, Vladimir Sementsov-Ogievskiy wrote:
In order to reuse bdrv_common_block_status_above in
bdrv_is_allocated_above, let's support include_base parameter.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
---
  block/coroutines.h |  2 ++
  block/io.c         | 21 ++++++++++++++-------
  2 files changed, 16 insertions(+), 7 deletions(-)


+++ b/block/io.c
@@ -2343,6 +2343,7 @@ early_out:
  int coroutine_fn
  bdrv_co_common_block_status_above(BlockDriverState *bs,
                                    BlockDriverState *base,
+                                  bool include_base,
                                    bool want_zero,
                                    int64_t offset,
                                    int64_t bytes,
@@ -2354,10 +2355,11 @@ bdrv_co_common_block_status_above(BlockDriverState *bs,
      BlockDriverState *p;
      int64_t eof = 0;
- assert(bs != base);
+    assert(include_base || bs != base);
+    assert(!include_base || base); /* Can't include NULL base */

I wonder if this would be easier to read as:

if (include_base) {
    assert(bs != base);
} else {
    assert(base); /* Can't include NULL base */
}

but I won't insist.

Reviewed-by: Eric Blake <eblake@redhat.com>

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