Received: from eggs.gnu.org ([2001:4830:134:3::10]:49415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brsIV-0007LX-PT for qemu-devel@nongnu.org; Wed, 05 Oct 2016 15:56:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brsIR-00068q-He for qemu-devel@nongnu.org; Wed, 05 Oct 2016 15:56:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brsIR-00068h-Ay for qemu-devel@nongnu.org; Wed, 05 Oct 2016 15:56:07 -0400 References: <1475503285-9021-1-git-send-email-den@openvz.org> <61bfc324-c3c6-8901-2761-1ea441786652@openvz.org> From: Laszlo Ersek Message-ID: Date: Wed, 5 Oct 2016 21:56:03 +0200 MIME-Version: 1.0 In-Reply-To: <61bfc324-c3c6-8901-2761-1ea441786652@openvz.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 1/1] qga: minimal support for fstrim for Windows guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" , qemu-devel@nongnu.org Cc: Denis Plotnikov , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Michael Roth , Stefan Weil On 10/05/16 21:47, Denis V. Lunev wrote: > 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 >>> Signed-off-by: Denis Plotnikov >>> CC: Michael Roth >>> CC: Stefan Weil >>> CC: Marc-Andr=C3=A9 Lureau >>> --- >>> 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 a= nd >> 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=3Don 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. >=20 > This patch implements the ability to trim all the disc as done for Linu= x > to go over all the disc and discard all possible areas. I think that th= is > would be useful f.e. to prepare template images. Thank you for explaining. And, now I've learned about "defrag /L" too :) Cheers Laszlo