From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNSrF-0004YZ-6K for qemu-devel@nongnu.org; Tue, 11 Mar 2014 16:01:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNSr9-0004i1-7k for qemu-devel@nongnu.org; Tue, 11 Mar 2014 16:01:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNSr8-0004hv-VY for qemu-devel@nongnu.org; Tue, 11 Mar 2014 16:00:55 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2BK0pKw017831 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Mar 2014 16:00:52 -0400 Date: Tue, 11 Mar 2014 20:00:50 +0000 From: "Richard W.M. Jones" Message-ID: <20140311200050.GU1346@redhat.com> References: <20140310161119.GA6744@redhat.com> <20140310161421.GB6744@redhat.com> <531DEEDD.20007@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <531DEEDD.20007@redhat.com> 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: Paolo Bonzini Cc: qemu-devel@nongnu.org Finally I tracked down the reason why my early test failed, but then it just started working "by magic". The reason is this: If you: - create an ext4 filesystem - mount it WITHOUT -o discard - create and remove some big files - unmount - mount -o discard - fstrim then the fstrim has no effect. If you: - create an ext4 filesystem - mount it WITH -o discard - create and remove some big files - unmount - mount -o discard - fstrim then the fstrim works. (Actually it's not necessary, because the previous 'rm' already recovered the space.) I have no idea why this is yet (still investigating). However the fstrim is suspiciously fast, so there's no way it can be scanning the whole disk for deleted files. I don't think fstrim does what it says in the man page. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top