The major missing step in order to implement thin provisioning is exposing discard commands to the guest. This series implements minimal control of this capability.
Whether to enable discard or not is made a host parameter, so that choices in storage technology do not affect the hardware that the guest sees. While it is still possible to fine-tune the parameters (at least for SCSI disks), the default granularity is set to the logical block size or 4k, whichever is largest, because cluster sizes below 4k are rarely used and 4K is a typical block size for files. Nevertheless, using DISCARD with filesystems can cause very severe fragmentation, so it is left default-off for now. This can change later when we implement the "anchor" operation for efficient management of preallocated files. Paolo Paolo Bonzini (5): block: implement BDRV_O_UNMAP blockdev: add discard suboption to -drive qemu-nbd: add --discard option blockdev: enable discard by default pc: add compatibility machine types for 1.4 block.c | 25 +++++++++++++++++++++++++ blockdev.c | 11 +++++++++++ hw/block-common.h | 2 +- hw/ide/qdev.c | 5 ++++- hw/pc.h | 32 ++++++++++++++++++++++++++++++++ hw/pc_piix.c | 18 ++++++++++++++++-- hw/pc_q35.c | 19 ++++++++++++++++--- hw/scsi-disk.c | 13 ++++++++++--- include/block/block.h | 2 ++ qemu-io.c | 11 +++++++++-- qemu-nbd.c | 18 +++++++++++++++--- qemu-nbd.texi | 4 ++++ qemu-options.hx | 2 ++ 13 files changed, 147 insertions(+), 15 deletions(-) -- 1.8.1.2