From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1sq0-0001Mf-GG for qemu-devel@nongnu.org; Wed, 24 Jul 2013 02:46:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1spz-0005OZ-J9 for qemu-devel@nongnu.org; Wed, 24 Jul 2013 02:46:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1spz-0005OT-9i for qemu-devel@nongnu.org; Wed, 24 Jul 2013 02:46:15 -0400 Message-ID: <51EF7814.9050304@redhat.com> Date: Wed, 24 Jul 2013 08:45:40 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <5D9ACBBCF6B270468D615C4719A59BE363DFE97F@szxeml548-mbx.china.huawei.com> <51EE2409.7030501@redhat.com> <5D9ACBBCF6B270468D615C4719A59BE363DFF990@szxeml548-mbx.china.huawei.com> In-Reply-To: <5D9ACBBCF6B270468D615C4719A59BE363DFF990@szxeml548-mbx.china.huawei.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] trim in windows guest witch virtio List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Libaiqing Cc: "qemu-devel@nongnu.org" Il 24/07/2013 02:53, Libaiqing ha scritto: > Hi paolo, > > I test window guest with ide device with the following config,trim with ide drive failed. > > 1 The host fs is ext4 with discard option: > /dev/sdb1 on /home/sdb type ext4 (rw,relatime,discard,data=ordered) > > 2 qemu config : ide drive with discard open > x86_64-softmmu/qemu-system-x86_64 -enable-kvm -name win7 -M pc-0.15 -m 1024 -smp 2 -boot c -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/home/win7_base.qcow2,if=ide,index=0,format=qcow2,id=ad -drive file=/home/sdb/raw.img,if=ide,index=1,format=raw,id=hd,discard=on -monitor stdio -vga qxl -vnc :1 -device usb-tablet,id=input0 TRIM is supported only on "-M pc-1.5" and "-M pc". > 3 In win7 guest,init drive d,fill it with files,then shift+del files > > 4 The file /home/sdb/raw.img does not become small,when listing with -s option. > > It seems that the windows ntfs does not send trim to ide controller. No IDE_DMA_TRIM request received. Note that this may not happen immediately. NTFS may send TRIM later. > Is there any config wrong? > > Btw,I found the info from the URL: http://msdn.microsoft.com/en-us/library/windows/desktop/hh848053(v=vs.85).aspx > Qemu can do the same thing like hyper-v with windows guest? I don't know, I never tested it with Windows guests. It looks like Windows 8 would not need a filter driver to do TRIM on SCSI disks (you could try with megasas, so that you do not need a driver for the HBA). Paolo