Am 02.07.2013 um 12:49 schrieb Paolo Bonzini <pbonz...@redhat.com>: > Il 02/07/2013 12:36, Peter Lieven ha scritto: >>>>> Perhaps we can have a new "discard_zeroes" field in bdrv_get_info, and >>>>> the unmap functionality can be moved up to qemu-img convert? >>>> >>>> Is there any other storage protocol out there that could benefit from it? >>> >>> Definitely LVM. Perhaps in the future gluster too, though right now it >>> only supports discard on files, not block devices. >> >> Is discards on LVM sth that is already implemented in qemu? > > Yes, it supports BLKDISCARD (see handle_aiocb_discard in > block/raw-posix.c). Of course there is no way to query the host > discard_zeroes setting yet.
No way in qemu or no way at all? > > But even if it weren't implemented in QEMU, you should aim at making it > easier (if it's not too much work, which it isn't), not harder. If you > do it in block/iscsi.c, the next person who comes will have to basically > undo your work and reimplement+retest it with the right API. > >> Would you mind if we postpone the general approach to a later point. >> It seems that this is much more complex than the iSCSI approach. > > It shouldn't be more complex at all, actually. You just need to pass > the maximum unmap sectors and lbprz parameters through bdrv_get_info. > > I'm not asking you to add support for BLKDISCARDZEROES and all that. > I'm asking you to do the work at the right level. You are right, if its possible in other protocols also it should be done at a higher level. I will at least look into integrating it into bdrv_get_info for iSCSI and implement the unmapping logic in qemu-img for the case that has_zero_init is 0. Peter