On 10/05/2016 09:55 PM, Laszlo Ersek wrote:
> On 10/03/16 16:01, Denis V. Lunev wrote:
>> Unfortunately, there is no public Windows API to start trimming the
>> filesystem. The only viable way here is to call 'defrag.exe /L' for
>> each volume.
>>
>> This is working since Win8 and Win2k12.
>>
>> Signed-off-by: Denis V. Lunev <d...@openvz.org>
>> Signed-off-by: Denis Plotnikov <dplotni...@virtuozzo.com>
>> CC: Michael Roth <mdr...@linux.vnet.ibm.com>
>> CC: Stefan Weil <s...@weilnetz.de>
>> CC: Marc-André Lureau <marcandre.lur...@gmail.com>
>> ---
>>  qga/commands-win32.c | 97 
>> ++++++++++++++++++++++++++++++++++++++++++++++++++--
>>  1 file changed, 94 insertions(+), 3 deletions(-)
> Just to educate myself (really, you can ignore my question as "review
> comment", because it's not one): why is this necessary? In Windows 8 and
> Windows Server 2012 R2, simply putting your NTFS filesystem on a SCSI
> disk (such as virtio-scsi-pci / scsi-hd) or AHCI, and specifying
> discard=on for the -drive, will result in the guest automatically
> trimming the NTFS (with a little delay) after deleting files, and the
> host getting those blocks back.
The same as for Linux. But if the one exact block has been freed
by half at one operation and by another half in the different operation
as far as I could understand it will not be freed.

This patch implements the ability to trim all the disc as done for Linux
to go over all the disc and discard all possible areas. I think that this
would be useful f.e. to prepare template images.

Den

Reply via email to