On 07/30/2012 07:57 AM, Paolo Bonzini wrote: > 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). Ooh, nice bullet point to add to my upcoming presentation at Linux Plumber's Conference in a month: http://summit.linuxplumbersconf.org/lpc-2012/meeting/33/lpc2012-ref-improved-virt-disk-handling/ Does anyone else have some annoyances about large sparse file handling where improving the kernel would make our life easier, that I should incorporate into my discussion? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org