From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN3Vn-00018t-S1 for qemu-devel@nongnu.org; Mon, 10 Mar 2014 12:57:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WN3Vh-0008Oo-Qr for qemu-devel@nongnu.org; Mon, 10 Mar 2014 12:57:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN3Vh-0008O8-GZ for qemu-devel@nongnu.org; Mon, 10 Mar 2014 12:57:05 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2AGv4ob019284 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Mar 2014 12:57:04 -0400 Message-ID: <531DEEDD.20007@redhat.com> Date: Mon, 10 Mar 2014 17:57:01 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20140310161119.GA6744@redhat.com> <20140310161421.GB6744@redhat.com> In-Reply-To: <20140310161421.GB6744@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Trying to get fstrim / discard=unmap to work List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" , qemu-devel@nongnu.org Il 10/03/2014 17:14, Richard W.M. Jones ha scritto: > On Mon, Mar 10, 2014 at 04:11:20PM +0000, Richard W.M. Jones wrote: >> Guest: >> - guest kernel: 3.13.4-200.fc20.x86_64 >> - ext4 guest filesystem >> - fstrim from util-linux 2.24.1 >> - cat /sys/block/sda/device/scsi_disk/*/provisioning_mode >> unmap > > I noticed that I wasn't mounting the guest filesystem with '-o discard'. > However it still doesn't work even after adding this option. Works here: $ qemu-system-x86_64 -drive discard=unmap,file=$HOME/jeos-19-64.qcow2,id=ff,if=none -device virtio-scsi-pci -device scsi-disk,drive=ff -vnc :0 --enable-kvm Before test: $ du -h jeos-19-64.qcow2 1,6G jeos-19-64.qcow2 After "dd if=/dev/zero of=foo bs=1M count=300": $ du -h jeos-19-64.qcow2 1,8G jeos-19-64.qcow2 After "rm foo; fstrim -v /": $ du -h jeos-19-64.qcow2 1,4G jeos-19-64.qcow2 I also set a breakpoint on fallocate64, and it was called. Paolo