On 12.08.19 14:14, Vladimir Sementsov-Ogievskiy wrote: > 09.08.2019 19:13, Max Reitz wrote: >> This changes iotest 204's output, because blkdebug on top of a COW node >> used to make qemu-img map disregard the rest of the backing chain (the >> backing chain was broken by the filter). With this patch, the >> allocation in the base image is reported correctly. >> >> Signed-off-by: Max Reitz >> --- >> qemu-img.c | 33 ++++++++++++++++++++------------- >> tests/qemu-iotests/204.out | 1 + >> 2 files changed, 21 insertions(+), 13 deletions(-) >> >> diff --git a/qemu-img.c b/qemu-img.c >> index 79983772de..3b30c5ae70 100644 >> --- a/qemu-img.c >> +++ b/qemu-img.c [...] >> @@ -2490,7 +2492,8 @@ static int img_convert(int argc, char **argv) >> * s.target_backing_sectors has to be negative, which it will >> * be automatically). The backing file length is used only >> * for optimizations, so such a case is not fatal. */ >> - s.target_backing_sectors = bdrv_nb_sectors(out_bs->backing->bs); >> + s.target_backing_sectors = >> + bdrv_nb_sectors(bdrv_filtered_cow_bs(out_bs)); > > why not skip_rw_filters? It will fail if out_bs is filter.. Because I forgot this place. :-) Although backing_chain_next() would be simpler here and do the same, effectively. Max