this patch adds the ability for targets to stay sparse during block migration (if the zero_blocks capability is set) and qemu-img convert even if the target does not have has_zero_init = 1.
the series was especially developed for iSCSI, but it should also work with other drivers with little or no adjustments. these adjustments should be limited to providing block provisioning information through get_block_info and/or honouring BDRV_REQ_MAY_UNMAP on writing zeroes. there are also 4 patches which are fixes/enhancements for the get_block_status API discovered during development of this series. v1->v2: - moved block max_discard and max_write_zeroes to BlockDriverState - added discard_alignment and write_zeroes_alignment to BlockDriverState - added bdrv_has_discard_zeroes() and bdrv_has_discard_write_zeroes() - added logic to bdrv_co_discard and bdrv_co_do_write_zeroes to honour limit and alignment info. - added support for -S 0 in qemu-img convert. Peter Lieven (20): block: make BdrvRequestFlags public block: add flags to bdrv_*_write_zeroes block: introduce BDRV_REQ_MAY_UNMAP request flag block: introduce bdrv_has_discard_zeroes and bdrv_has_discard_write_zeroes block/raw: add bdrv_has_discard_zeroes and bdrv_has_discard_write_zeroes block: add discard and write_zeroes limits and alignment to BlockDriverState block: honour alignment and limit in bdrv_co_do_write_zeroes block: honour alignment and limit in bdrv_co_discard iscsi: simplify iscsi_co_discard iscsi: set limits in BlockDriverState iscsi: add bdrv_has_discard_zeroes and bdrv_has_discard_write_zeroes iscsi: add bdrv_co_write_zeroes block: introduce bdrv_zeroize block/get_block_status: set *pnum = 0 on error block/get_block_status: avoid segfault if there is no backing_hd block/get_block_status: avoid redundant callouts on raw devices block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks qemu-img: add support for fully allocated images qemu-img: conditionally zero out target on convert block/raw: copy block limits and alignment information on raw_open block-migration.c | 3 +- block.c | 187 ++++++++++++++++++++++++++++++++++++--------- block/backup.c | 3 +- block/iscsi.c | 148 +++++++++++++++++++++++++---------- block/qcow2.c | 2 +- block/qed.c | 3 +- block/raw_bsd.c | 65 ++++++++++------ block/vmdk.c | 3 +- include/block/block.h | 19 ++++- include/block/block_int.h | 27 ++++++- qemu-img.c | 18 ++++- qemu-io-cmds.c | 2 +- 12 files changed, 368 insertions(+), 112 deletions(-) -- 1.7.9.5