From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W87bw-00050y-HX for qemu-devel@nongnu.org; Tue, 28 Jan 2014 07:17:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W87bn-0001QD-8i for qemu-devel@nongnu.org; Tue, 28 Jan 2014 07:17:48 -0500 Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]:52765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W87bn-0001Pw-0r for qemu-devel@nongnu.org; Tue, 28 Jan 2014 07:17:39 -0500 Received: by mail-pd0-f172.google.com with SMTP id p10so286347pdj.31 for ; Tue, 28 Jan 2014 04:17:38 -0800 (PST) Message-ID: <52E79FDF.6050502@gmail.com> Date: Tue, 28 Jan 2014 20:17:35 +0800 From: ching MIME-Version: 1.0 References: <42130e08.kqhkiG.143d8676094@gmail.com> <52E78A9C.2010903@redhat.com> In-Reply-To: <52E78A9C.2010903@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] check trim/unmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Thanks for the information. Hopefully, there will be better debug/tracing facility for this. This is useful for sysadmin to ensure the whole storage stack is functioning as expected. ching On 28/01/2014 06:46 PM, Paolo Bonzini wrote: > Il 28/01/2014 11:31, ching ha scritto: >> My config is Gentoo x64 stable branch, kernel 3.10, libvirt 1.1.3, qemu 1.5, lvm2(non-thin) on ssd >> >> How can i check that if: >> 1. qemu receives trim/unmap from guest >> 2. qemu is punching hole/issue blkdiscards/writing zeros? > > First of all, I suggest that you use current QEMU git. The trim/unmap feature was completed after 1.7 was released. > > To use trim/discard, you need to use the discard=on option for QEMU's -drive command-line option. You also need to use cache=none (because of a Linux kernel bug, QEMU may disable thin provisioning in other cache modes). > > In libvirt, this means adding cache='none and discard='on' like this: > > > > You can check if QEMU is punching a hole into a file using "qemu-img map" on the file. You must not run "qemu-img map" while the VM is running though; that can give incorrect results. There is no equivalent for block devices yet. > > Paolo