From: Roman Kagan <rka...@parallels.com> Add backing file support to Parallels format driver.
That said, I think backing file operations should end up in the generic block layer, but that's a longer story... Signed-off-by: Roman Kagan <rka...@parallels.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> CC: Jeff Cody <jc...@redhat.com> CC: Kevin Wolf <kw...@redhat.com> CC: Stefan Hajnoczi <stefa...@redhat.com> --- block/parallels.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 2d3e962..718274b 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -419,6 +419,11 @@ static int parallels_read(BlockDriverState *bs, int64_t sector_num, if (ret < 0) { return ret; } + } else if (bs->backing_hd) { + int ret = bdrv_read(bs->backing_hd, sector_num, buf, n); + if (ret < 0) { + return ret; + } } else { memset(buf, 0, n << BDRV_SECTOR_BITS); } @@ -454,6 +459,7 @@ static BlockDriver bdrv_parallels = { .bdrv_read = parallels_co_read, .bdrv_close = parallels_close, .bdrv_co_get_block_status = parallels_co_get_block_status, + .supports_backing = true, }; static void bdrv_parallels_init(void) -- 1.9.1