On 29.05.19 19:56, Andrey Shinkevich wrote: > This patch is used in the 'block/stream: introduce a bottom node' > that is following. Instead of the base node, the caller may pass > the node that has the base as its backing image to the function > bdrv_is_allocated_above() with a new parameter include_base = true > and get rid of the dependency on the base that may change during > commit/stream parallel jobs. Now, if the specified base is not > found in the backing image chain, the QEMU will abort. > > Suggested-by: Vladimir Sementsov-Ogievskiy > Signed-off-by: Andrey Shinkevich > Reviewed-by: Vladimir Sementsov-Ogievskiy > Reviewed-by: Alberto Garcia > --- > block/commit.c | 2 +- > block/io.c | 21 +++++++++++++++------ > block/mirror.c | 2 +- > block/replication.c | 2 +- > block/stream.c | 2 +- > include/block/block.h | 3 ++- > 6 files changed, 21 insertions(+), 11 deletions(-) This needs the following hunk squashed in so it still compiles: (I can do that, if you agree.) diff --git a/block/qcow2.c b/block/qcow2.c index 9396d490d5..2a59eb27fe 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2148,7 +2148,8 @@ static bool is_unallocated(BlockDriverState *bs, int64_t offset, int64_t bytes) { int64_t nr; return !bytes || - (!bdrv_is_allocated_above(bs, NULL, offset, bytes, &nr) && nr == bytes); + (!bdrv_is_allocated_above(bs, NULL, false, offset, bytes, &nr) && + nr == bytes); } static bool is_zero_cow(BlockDriverState *bs, QCowL2Meta *m) diff --git a/qemu-img.c b/qemu-img.c index 158b3a505f..79983772de 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -3518,7 +3518,7 @@ static int img_rebase(int argc, char **argv) * to take action */ ret = bdrv_is_allocated_above(backing_bs(bs), prefix_chain_bs, - offset, n, &n); + false, offset, n, &n); if (ret < 0) { error_report("error while reading image metadata: %s", strerror(-ret));