From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WORRQ-0007F7-0f for qemu-devel@nongnu.org; Fri, 14 Mar 2014 08:42:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WORRL-000429-7h for qemu-devel@nongnu.org; Fri, 14 Mar 2014 08:42:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WORRK-000421-VS for qemu-devel@nongnu.org; Fri, 14 Mar 2014 08:42:19 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2ECgIoP009088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 14 Mar 2014 08:42:18 -0400 Date: Fri, 14 Mar 2014 12:42:16 +0000 From: "Richard W.M. Jones" Message-ID: <20140314124216.GQ1346@redhat.com> References: <20140313214814.GC1985@redhat.com> <5322F670.50906@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5322F670.50906@redhat.com> Subject: Re: [Qemu-devel] fstrim & upstream kernel not working List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Fri, Mar 14, 2014 at 01:30:40PM +0100, Paolo Bonzini wrote: > Il 13/03/2014 22:49, Richard W.M. Jones ha scritto: > >- Is there any reason why virtio-scsi doesn't emulate WRITE SAME? > > Yes, the reason is that you're using QEMU 1.7. :) > > >- Can you see where ext4 issues the zeroout/write same call? AFAICT > >it is still issuing discards, but these are getting turned into > >zeroout/write same by some sort of block layer magic that I can't > >quite follow. > > That's provisioning_mode, which is writesame_16 with QEMU 1.7 and > unmap with QEMU 2.0. Got it. This morning I was trying kernel from git + qemu from git together. This works, sort of. Firstly I tightened up the automated tests[1] of trimming. Previously we just tested that >= 1 block was freed in the host file. Now I'm checking that >= 512 KB is freed. This change revealed that fstrim was only trimming about 64 KB from the host file (although -o discard and blkdiscard tests[1] work as expected). I worked around this in any case by rearranging the test [2]: Doing: rm /a_big_file fstrim / sync umount / [shut down qemu] would only trim 64 KB on the host. Doing: rm /a_big_file umount / # added mount -o nodiscard /dev/sda / # added fstrim / sync umount / [shut down qemu] would trim the expected amount (around 10 MB). I've no idea why this is (looks like an ext4/kernel bug to me), but in any case the tests now use the second method[2]. Rich. [1] https://github.com/libguestfs/libguestfs/tree/master/tests/discard [2] https://github.com/libguestfs/libguestfs/commit/accf1b66aa835714690a2979e990c49243875dab -- 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