Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
For better support for older versions of libiscsi I think it would be good to convert all the iscsi_unmap_task/iscsi_writesame*_task/iscsi_*_task functions with calls to the much more genric iscsi_scsi_command_sync(). iscsi_scsi_command_sync() and iscsi_scsi_command_async() have been available since prior to version 1.1 and can be used to send arbitrary scsi opcodes to the target. iscsi_scsi_command_async() is already used instead of iscs_read16/write16_async() since the read16/write16 helpers were added to libiscsi at a much later stage and there are examples of its use. Using iscsi_scsi_command_[a]sync() instead of for example iscsi_unmap_task() would mean that you can use the UNMAP opcode always, regardless version of libiscsi. It would mean that you need to build the CDB directly inside block/iscsi.c but that is not hard. I.e. change block/iscsi.c to only use iscsi_scsi_command_[a]sync() for all opcodes it wants to send to the target. On Wed, Nov 6, 2013 at 1:16 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 06/11/2013 20:38, Peter Lieven ha scritto: Am 06.11.2013 um 14:09 schrieb Paolo Bonzini pbonz...@redhat.com: Il 06/11/2013 14:08, Stefan Hajnoczi ha scritto: Thanks, applied to my block-next tree: https://github.com/stefanha/qemu/commits/block-next This will go into QEMU 1.8. Since it's a new feature that touches core block layer code and several block drivers, I can't merge it into 1.7-rc. Yay! With these patches I can properly emulate WRITE SAME in the SCSI layer. Yes, you can, but only when write same is used to write zeroes. The other case is still unhandled or needs emulation. WRITE SAME with UNMAP is incorrect in the current QEMU code. Your patch let me fix it so that the payload can be read back with no change, *and* sectors are unmapped when possible. Paolo
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
It would mean that any version of libiscsi from 1.1 or later would work and there would not be the issues such as UNMAP is only available from 1.2 and forward, WRITESAME* is only availabel from 1.3. SANITIZE only being available from 1.9 ... On Fri, Nov 8, 2013 at 9:52 AM, ronnie sahlberg ronniesahlb...@gmail.com wrote: For better support for older versions of libiscsi I think it would be good to convert all the iscsi_unmap_task/iscsi_writesame*_task/iscsi_*_task functions with calls to the much more genric iscsi_scsi_command_sync(). iscsi_scsi_command_sync() and iscsi_scsi_command_async() have been available since prior to version 1.1 and can be used to send arbitrary scsi opcodes to the target. iscsi_scsi_command_async() is already used instead of iscs_read16/write16_async() since the read16/write16 helpers were added to libiscsi at a much later stage and there are examples of its use. Using iscsi_scsi_command_[a]sync() instead of for example iscsi_unmap_task() would mean that you can use the UNMAP opcode always, regardless version of libiscsi. It would mean that you need to build the CDB directly inside block/iscsi.c but that is not hard. I.e. change block/iscsi.c to only use iscsi_scsi_command_[a]sync() for all opcodes it wants to send to the target. On Wed, Nov 6, 2013 at 1:16 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 06/11/2013 20:38, Peter Lieven ha scritto: Am 06.11.2013 um 14:09 schrieb Paolo Bonzini pbonz...@redhat.com: Il 06/11/2013 14:08, Stefan Hajnoczi ha scritto: Thanks, applied to my block-next tree: https://github.com/stefanha/qemu/commits/block-next This will go into QEMU 1.8. Since it's a new feature that touches core block layer code and several block drivers, I can't merge it into 1.7-rc. Yay! With these patches I can properly emulate WRITE SAME in the SCSI layer. Yes, you can, but only when write same is used to write zeroes. The other case is still unhandled or needs emulation. WRITE SAME with UNMAP is incorrect in the current QEMU code. Your patch let me fix it so that the payload can be read back with no change, *and* sectors are unmapped when possible. Paolo
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
Am 08.11.2013 um 18:52 schrieb ronnie sahlberg ronniesahlb...@gmail.com: For better support for older versions of libiscsi I think it would be good to convert all the iscsi_unmap_task/iscsi_writesame*_task/iscsi_*_task functions with calls to the much more genric iscsi_scsi_command_sync(). iscsi_scsi_command_sync() and iscsi_scsi_command_async() have been available since prior to version 1.1 and can be used to send arbitrary scsi opcodes to the target. iscsi_scsi_command_async() is already used instead of iscs_read16/write16_async() since the read16/write16 helpers were added to libiscsi at a much later stage and there are examples of its use. Using iscsi_scsi_command_[a]sync() instead of for example iscsi_unmap_task() would mean that you can use the UNMAP opcode always, regardless version of libiscsi. It would mean that you need to build the CDB directly inside block/iscsi.c but that is not hard. I.e. change block/iscsi.c to only use iscsi_scsi_command_[a]sync() for all opcodes it wants to send to the target. Hi Ronnie, i would prefer to use the helper functions. It makes the code much, much easier to read. In general you are talking about the case that we have a totally outdated libiscsi version, but a absolutely up to date qemu version. If someone wants to compile a recent qemu on an old distro, this is working, but simply not with all features enabled. We keep basic support for read, write, flush. This works with any libiscsi version. If someone wants to have support for write_zeroes, discard or get_block_status he simply must use a recent libiscsi version. Peter On Wed, Nov 6, 2013 at 1:16 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 06/11/2013 20:38, Peter Lieven ha scritto: Am 06.11.2013 um 14:09 schrieb Paolo Bonzini pbonz...@redhat.com: Il 06/11/2013 14:08, Stefan Hajnoczi ha scritto: Thanks, applied to my block-next tree: https://github.com/stefanha/qemu/commits/block-next This will go into QEMU 1.8. Since it's a new feature that touches core block layer code and several block drivers, I can't merge it into 1.7-rc. Yay! With these patches I can properly emulate WRITE SAME in the SCSI layer. Yes, you can, but only when write same is used to write zeroes. The other case is still unhandled or needs emulation. WRITE SAME with UNMAP is incorrect in the current QEMU code. Your patch let me fix it so that the payload can be read back with no change, *and* sectors are unmapped when possible. Paolo
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
Am 08.11.2013 um 19:03 schrieb ronnie sahlberg ronniesahlb...@gmail.com: It would mean that any version of libiscsi from 1.1 or later would work and there would not be the issues such as UNMAP is only available from 1.2 and forward, WRITESAME* is only availabel from 1.3. I think 1.3.0 is not a big requirement when the recent version is 1.8.0 SANITIZE only being available from 1.9 … Sanitize we do not use at all currently. Peter On Fri, Nov 8, 2013 at 9:52 AM, ronnie sahlberg ronniesahlb...@gmail.com wrote: For better support for older versions of libiscsi I think it would be good to convert all the iscsi_unmap_task/iscsi_writesame*_task/iscsi_*_task functions with calls to the much more genric iscsi_scsi_command_sync(). iscsi_scsi_command_sync() and iscsi_scsi_command_async() have been available since prior to version 1.1 and can be used to send arbitrary scsi opcodes to the target. iscsi_scsi_command_async() is already used instead of iscs_read16/write16_async() since the read16/write16 helpers were added to libiscsi at a much later stage and there are examples of its use. Using iscsi_scsi_command_[a]sync() instead of for example iscsi_unmap_task() would mean that you can use the UNMAP opcode always, regardless version of libiscsi. It would mean that you need to build the CDB directly inside block/iscsi.c but that is not hard. I.e. change block/iscsi.c to only use iscsi_scsi_command_[a]sync() for all opcodes it wants to send to the target. On Wed, Nov 6, 2013 at 1:16 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 06/11/2013 20:38, Peter Lieven ha scritto: Am 06.11.2013 um 14:09 schrieb Paolo Bonzini pbonz...@redhat.com: Il 06/11/2013 14:08, Stefan Hajnoczi ha scritto: Thanks, applied to my block-next tree: https://github.com/stefanha/qemu/commits/block-next This will go into QEMU 1.8. Since it's a new feature that touches core block layer code and several block drivers, I can't merge it into 1.7-rc. Yay! With these patches I can properly emulate WRITE SAME in the SCSI layer. Yes, you can, but only when write same is used to write zeroes. The other case is still unhandled or needs emulation. WRITE SAME with UNMAP is incorrect in the current QEMU code. Your patch let me fix it so that the payload can be read back with no change, *and* sectors are unmapped when possible. Paolo
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
On Thu, Oct 24, 2013 at 12:06:49PM +0200, Peter Lieven wrote: 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. v6-v7: - switched position of iscsi: set limits in BlockDriverState and iscsi: simplify iscsi_co_discard. (Paolo) - fixed commit message of block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks. (Paolo) - moved block/raw: copy BlockLimits on raw_open right after block: add BlockLimits structure to BlockDriverState. (Paolo) - Reworded desciption for -S 0 in qemu-img: add support for fully allocated images as suggested by Paolo. - Reworded commit message of: qemu-img: conditionally zero out target on convert. regarding iscsi (Paolo) v5-v6: - protected iscsi_co_write_zeroes by the existence of the SCSI_SENSE_ASCQ_CAPACITY_DATA_HAS_CHANGED macro. This is ugly but necessary because the semantic of iscsi_writesame16_task silently changed between libiscsi 1.8.0 and 1.9.0. The above macro was the first added after the change. I already contacted Ronnie to introduce an API version macro which has to be bumped on each new function that will be added. Changes to the parameters should not happen at all of course. v4-v5: - new patches 4-6 to move the block provisioning information to the BlockDriverInfo. - kept 2 wrappers to read the information from the BDI and renamed them to make more clear what they do: bdrv_has_discard_zeroes - bdrv_unallocated_blocks_are_zero bdrv_has_discard_write_zeroes - bdrv_can_write_zeroes_with_unmap - added additional information about the 2 flags in the BDI struct in block.h v3-v4: - changed BlockLimits struct to typedef (Stefan, Eric) - renamed bdrv_zeroize to bdrv_make_zero (Stefan) - added comment about the -S flag of qemu-img convert in qemu-img.texi (Eric) - used struct assignment for bs-bl in raw_open (Stefan, Eric) - dropped 3 get_block_status fixes that are independent of this series and already partly merged. v2-v3: - fix merge conflict in block/qcow2_cluster.c - changed return type of bdrv_has_discard_zeroes and bdrv_has_discard_write_zeroes to bool. - moved alignment and limits info to a BlockLimits struct (Paolo). - added magic constanst for default maximum in bdrv_co_do_write_zeroes and bdrv_co_discard (Eric). - bdrv_co_do_write_zeroes: allocating the bounce buffer only once (Eric), fixed bounce iov_len in the fall back path. - bdrv_zeroize: added inline docu (Eric) and do not mask flags passed to bdrv_write_zeroes (Eric). - qemu-img: changed the default hint for -S (min_sparse) in the usage help to 4k. not changing the default as it is unclear why this default was set. size suffixes are already supported (Eric). 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 (17): block: make BdrvRequestFlags public block: add flags to bdrv_*_write_zeroes block: introduce BDRV_REQ_MAY_UNMAP request flag block: add logical block provisioning info to BlockDriverInfo block: add wrappers for logical block provisioning information block/iscsi: add .bdrv_get_info block: add BlockLimits structure to BlockDriverState block/raw: copy BlockLimits on raw_open block: honour BlockLimits in bdrv_co_do_write_zeroes block: honour BlockLimits in bdrv_co_discard iscsi: set limits in BlockDriverState iscsi: simplify iscsi_co_discard iscsi: add bdrv_co_write_zeroes block: introduce bdrv_make_zero 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-migration.c |3 +- block.c | 200 + block/backup.c|3 +- block/iscsi.c | 150 +- block/qcow2-cluster.c |2 +- block/qcow2.c |2 +- block/qed.c |3 +- block/raw_bsd.c |6 +- block/vmdk.c |3 +- include/block/block.h | 35 +++- include/block/block_int.h | 19 - qemu-img.c| 20 -
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
Il 06/11/2013 14:08, Stefan Hajnoczi ha scritto: Thanks, applied to my block-next tree: https://github.com/stefanha/qemu/commits/block-next This will go into QEMU 1.8. Since it's a new feature that touches core block layer code and several block drivers, I can't merge it into 1.7-rc. Yay! With these patches I can properly emulate WRITE SAME in the SCSI layer. Paolo
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
Am 06.11.2013 um 14:08 schrieb Stefan Hajnoczi stefa...@gmail.com: On Thu, Oct 24, 2013 at 12:06:49PM +0200, Peter Lieven wrote: 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. v6-v7: - switched position of iscsi: set limits in BlockDriverState and iscsi: simplify iscsi_co_discard. (Paolo) - fixed commit message of block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks. (Paolo) - moved block/raw: copy BlockLimits on raw_open right after block: add BlockLimits structure to BlockDriverState. (Paolo) - Reworded desciption for -S 0 in qemu-img: add support for fully allocated images as suggested by Paolo. - Reworded commit message of: qemu-img: conditionally zero out target on convert. regarding iscsi (Paolo) v5-v6: - protected iscsi_co_write_zeroes by the existence of the SCSI_SENSE_ASCQ_CAPACITY_DATA_HAS_CHANGED macro. This is ugly but necessary because the semantic of iscsi_writesame16_task silently changed between libiscsi 1.8.0 and 1.9.0. The above macro was the first added after the change. I already contacted Ronnie to introduce an API version macro which has to be bumped on each new function that will be added. Changes to the parameters should not happen at all of course. v4-v5: - new patches 4-6 to move the block provisioning information to the BlockDriverInfo. - kept 2 wrappers to read the information from the BDI and renamed them to make more clear what they do: bdrv_has_discard_zeroes - bdrv_unallocated_blocks_are_zero bdrv_has_discard_write_zeroes - bdrv_can_write_zeroes_with_unmap - added additional information about the 2 flags in the BDI struct in block.h v3-v4: - changed BlockLimits struct to typedef (Stefan, Eric) - renamed bdrv_zeroize to bdrv_make_zero (Stefan) - added comment about the -S flag of qemu-img convert in qemu-img.texi (Eric) - used struct assignment for bs-bl in raw_open (Stefan, Eric) - dropped 3 get_block_status fixes that are independent of this series and already partly merged. v2-v3: - fix merge conflict in block/qcow2_cluster.c - changed return type of bdrv_has_discard_zeroes and bdrv_has_discard_write_zeroes to bool. - moved alignment and limits info to a BlockLimits struct (Paolo). - added magic constanst for default maximum in bdrv_co_do_write_zeroes and bdrv_co_discard (Eric). - bdrv_co_do_write_zeroes: allocating the bounce buffer only once (Eric), fixed bounce iov_len in the fall back path. - bdrv_zeroize: added inline docu (Eric) and do not mask flags passed to bdrv_write_zeroes (Eric). - qemu-img: changed the default hint for -S (min_sparse) in the usage help to 4k. not changing the default as it is unclear why this default was set. size suffixes are already supported (Eric). 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 (17): block: make BdrvRequestFlags public block: add flags to bdrv_*_write_zeroes block: introduce BDRV_REQ_MAY_UNMAP request flag block: add logical block provisioning info to BlockDriverInfo block: add wrappers for logical block provisioning information block/iscsi: add .bdrv_get_info block: add BlockLimits structure to BlockDriverState block/raw: copy BlockLimits on raw_open block: honour BlockLimits in bdrv_co_do_write_zeroes block: honour BlockLimits in bdrv_co_discard iscsi: set limits in BlockDriverState iscsi: simplify iscsi_co_discard iscsi: add bdrv_co_write_zeroes block: introduce bdrv_make_zero 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-migration.c |3 +- block.c | 200 + block/backup.c|3 +- block/iscsi.c | 150 +- block/qcow2-cluster.c |2 +- block/qcow2.c |2 +- block/qed.c |3 +- block/raw_bsd.c |6 +- block/vmdk.c |3 +- include/block/block.h | 35 +++- include/block/block_int.h | 19 - qemu-img.c| 20 - qemu-img.texi |
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
Am 06.11.2013 um 14:09 schrieb Paolo Bonzini pbonz...@redhat.com: Il 06/11/2013 14:08, Stefan Hajnoczi ha scritto: Thanks, applied to my block-next tree: https://github.com/stefanha/qemu/commits/block-next This will go into QEMU 1.8. Since it's a new feature that touches core block layer code and several block drivers, I can't merge it into 1.7-rc. Yay! With these patches I can properly emulate WRITE SAME in the SCSI layer. Yes, you can, but only when write same is used to write zeroes. The other case is still unhandled or needs emulation. Peter
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
Il 06/11/2013 20:38, Peter Lieven ha scritto: Am 06.11.2013 um 14:09 schrieb Paolo Bonzini pbonz...@redhat.com: Il 06/11/2013 14:08, Stefan Hajnoczi ha scritto: Thanks, applied to my block-next tree: https://github.com/stefanha/qemu/commits/block-next This will go into QEMU 1.8. Since it's a new feature that touches core block layer code and several block drivers, I can't merge it into 1.7-rc. Yay! With these patches I can properly emulate WRITE SAME in the SCSI layer. Yes, you can, but only when write same is used to write zeroes. The other case is still unhandled or needs emulation. WRITE SAME with UNMAP is incorrect in the current QEMU code. Your patch let me fix it so that the payload can be read back with no change, *and* sectors are unmapped when possible. Paolo
[Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
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. v6-v7: - switched position of iscsi: set limits in BlockDriverState and iscsi: simplify iscsi_co_discard. (Paolo) - fixed commit message of block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks. (Paolo) - moved block/raw: copy BlockLimits on raw_open right after block: add BlockLimits structure to BlockDriverState. (Paolo) - Reworded desciption for -S 0 in qemu-img: add support for fully allocated images as suggested by Paolo. - Reworded commit message of: qemu-img: conditionally zero out target on convert. regarding iscsi (Paolo) v5-v6: - protected iscsi_co_write_zeroes by the existence of the SCSI_SENSE_ASCQ_CAPACITY_DATA_HAS_CHANGED macro. This is ugly but necessary because the semantic of iscsi_writesame16_task silently changed between libiscsi 1.8.0 and 1.9.0. The above macro was the first added after the change. I already contacted Ronnie to introduce an API version macro which has to be bumped on each new function that will be added. Changes to the parameters should not happen at all of course. v4-v5: - new patches 4-6 to move the block provisioning information to the BlockDriverInfo. - kept 2 wrappers to read the information from the BDI and renamed them to make more clear what they do: bdrv_has_discard_zeroes - bdrv_unallocated_blocks_are_zero bdrv_has_discard_write_zeroes - bdrv_can_write_zeroes_with_unmap - added additional information about the 2 flags in the BDI struct in block.h v3-v4: - changed BlockLimits struct to typedef (Stefan, Eric) - renamed bdrv_zeroize to bdrv_make_zero (Stefan) - added comment about the -S flag of qemu-img convert in qemu-img.texi (Eric) - used struct assignment for bs-bl in raw_open (Stefan, Eric) - dropped 3 get_block_status fixes that are independent of this series and already partly merged. v2-v3: - fix merge conflict in block/qcow2_cluster.c - changed return type of bdrv_has_discard_zeroes and bdrv_has_discard_write_zeroes to bool. - moved alignment and limits info to a BlockLimits struct (Paolo). - added magic constanst for default maximum in bdrv_co_do_write_zeroes and bdrv_co_discard (Eric). - bdrv_co_do_write_zeroes: allocating the bounce buffer only once (Eric), fixed bounce iov_len in the fall back path. - bdrv_zeroize: added inline docu (Eric) and do not mask flags passed to bdrv_write_zeroes (Eric). - qemu-img: changed the default hint for -S (min_sparse) in the usage help to 4k. not changing the default as it is unclear why this default was set. size suffixes are already supported (Eric). 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 (17): block: make BdrvRequestFlags public block: add flags to bdrv_*_write_zeroes block: introduce BDRV_REQ_MAY_UNMAP request flag block: add logical block provisioning info to BlockDriverInfo block: add wrappers for logical block provisioning information block/iscsi: add .bdrv_get_info block: add BlockLimits structure to BlockDriverState block/raw: copy BlockLimits on raw_open block: honour BlockLimits in bdrv_co_do_write_zeroes block: honour BlockLimits in bdrv_co_discard iscsi: set limits in BlockDriverState iscsi: simplify iscsi_co_discard iscsi: add bdrv_co_write_zeroes block: introduce bdrv_make_zero 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-migration.c |3 +- block.c | 200 + block/backup.c|3 +- block/iscsi.c | 150 +- block/qcow2-cluster.c |2 +- block/qcow2.c |2 +- block/qed.c |3 +- block/raw_bsd.c |6 +- block/vmdk.c |3 +- include/block/block.h | 35 +++- include/block/block_int.h | 19 - qemu-img.c| 20 - qemu-img.texi |6 ++ qemu-io-cmds.c|2 +- 14 files changed, 366 insertions(+), 88 deletions(-) -- 1.7.9.5
Re: [Qemu-devel] [PATCHv7 00/17] block: logical block provisioning enhancements
Il 24/10/2013 11:06, Peter Lieven ha scritto: 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. v6-v7: - switched position of iscsi: set limits in BlockDriverState and iscsi: simplify iscsi_co_discard. (Paolo) - fixed commit message of block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks. (Paolo) - moved block/raw: copy BlockLimits on raw_open right after block: add BlockLimits structure to BlockDriverState. (Paolo) - Reworded desciption for -S 0 in qemu-img: add support for fully allocated images as suggested by Paolo. - Reworded commit message of: qemu-img: conditionally zero out target on convert. regarding iscsi (Paolo) v5-v6: - protected iscsi_co_write_zeroes by the existence of the SCSI_SENSE_ASCQ_CAPACITY_DATA_HAS_CHANGED macro. This is ugly but necessary because the semantic of iscsi_writesame16_task silently changed between libiscsi 1.8.0 and 1.9.0. The above macro was the first added after the change. I already contacted Ronnie to introduce an API version macro which has to be bumped on each new function that will be added. Changes to the parameters should not happen at all of course. v4-v5: - new patches 4-6 to move the block provisioning information to the BlockDriverInfo. - kept 2 wrappers to read the information from the BDI and renamed them to make more clear what they do: bdrv_has_discard_zeroes - bdrv_unallocated_blocks_are_zero bdrv_has_discard_write_zeroes - bdrv_can_write_zeroes_with_unmap - added additional information about the 2 flags in the BDI struct in block.h v3-v4: - changed BlockLimits struct to typedef (Stefan, Eric) - renamed bdrv_zeroize to bdrv_make_zero (Stefan) - added comment about the -S flag of qemu-img convert in qemu-img.texi (Eric) - used struct assignment for bs-bl in raw_open (Stefan, Eric) - dropped 3 get_block_status fixes that are independent of this series and already partly merged. v2-v3: - fix merge conflict in block/qcow2_cluster.c - changed return type of bdrv_has_discard_zeroes and bdrv_has_discard_write_zeroes to bool. - moved alignment and limits info to a BlockLimits struct (Paolo). - added magic constanst for default maximum in bdrv_co_do_write_zeroes and bdrv_co_discard (Eric). - bdrv_co_do_write_zeroes: allocating the bounce buffer only once (Eric), fixed bounce iov_len in the fall back path. - bdrv_zeroize: added inline docu (Eric) and do not mask flags passed to bdrv_write_zeroes (Eric). - qemu-img: changed the default hint for -S (min_sparse) in the usage help to 4k. not changing the default as it is unclear why this default was set. size suffixes are already supported (Eric). 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 (17): block: make BdrvRequestFlags public block: add flags to bdrv_*_write_zeroes block: introduce BDRV_REQ_MAY_UNMAP request flag block: add logical block provisioning info to BlockDriverInfo block: add wrappers for logical block provisioning information block/iscsi: add .bdrv_get_info block: add BlockLimits structure to BlockDriverState block/raw: copy BlockLimits on raw_open block: honour BlockLimits in bdrv_co_do_write_zeroes block: honour BlockLimits in bdrv_co_discard iscsi: set limits in BlockDriverState iscsi: simplify iscsi_co_discard iscsi: add bdrv_co_write_zeroes block: introduce bdrv_make_zero 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-migration.c |3 +- block.c | 200 + block/backup.c|3 +- block/iscsi.c | 150 +- block/qcow2-cluster.c |2 +- block/qcow2.c |2 +- block/qed.c |3 +- block/raw_bsd.c |6 +- block/vmdk.c |3 +- include/block/block.h | 35 +++- include/block/block_int.h | 19 - qemu-img.c| 20 - qemu-img.texi |