Il 30/07/2012 15:51, Richard W.M. Jones ha scritto: >> > Or just finish up discard support and use the existing fstrim command of >> > qemu-ga. :) > What's actually involved to do this? I noticed that a virtio-scsi on > qcow2 v3 device exported to the guest does not appear to support TRIM > at all (see attached test script and output).
The most basic thing to do is to pass -device discard_granularity=NNN, where NNN should be the cluster size of the device. On top of this you need to add the ability to do TRIM asynchronously, quite some testing, and perhaps improving the disk formats so that they support sector-granularity discard. Patches for asynchronous TRIM are in the works (the threadpool patches on the list are the first step). Long term I would like the ability to distinguish discard-for-thin-provisioning ("may cause fragmentation, all subsequent accesses could be slower") from discard-for-wear-leveling ("only the first subsequent access would be slowed down"). This requires changes at all levels (host kernel, QEMU, management, guest kernel, and possibly guest applications). Paolo