From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzpGJ-0003rp-Jp for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:32:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzpGD-00026o-Fg for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:32:55 -0400 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:50330 helo=mx01.kamp.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1UzpGD-00026U-4r for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:32:49 -0400 Message-ID: <51E7FC87.1040207@kamp.de> Date: Thu, 18 Jul 2013 16:32:39 +0200 From: Peter Lieven MIME-Version: 1.0 References: <1373885375-13601-5-git-send-email-pl@kamp.de> <20130717084648.GD2458@dhcp-200-207.str.redhat.com> <51E66ACD.70706@redhat.com> <20130717102551.GF2458@dhcp-200-207.str.redhat.com> <51E6C5FC.1030304@redhat.com> <7C1EEB41-E2B3-4186-9188-379F02E76FF9@kamp.de> <51E6CE81.6000400@redhat.com> <36C25446-54C7-4D1F-9D8D-E8A3991489BD@kamp.de> <20130718092316.GG3582@dhcp-200-207.str.redhat.com> <51E7C260.50404@redhat.com> <51E7C707.7010101@kamp.de> <51E7C9C4.5010202@redhat.com> <51E7CBC8.1010804@kamp.de> <51E7E035.3010702@redhat.com> <51E7EDD0.6050001@kamp.de> <51E7F332.9020607@redhat.com> <51E7F715.3020706@kamp.de> <51E7F9CB.7050304@redhat.com> In-Reply-To: <51E7F9CB.7050304@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/4] qemu-img: conditionally discard target on convert List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel , ronnie sahlberg On 18.07.2013 16:20, Paolo Bonzini wrote: > Il 18/07/2013 16:09, Peter Lieven ha scritto: >> On 18.07.2013 15:52, Paolo Bonzini wrote: >>> Il 18/07/2013 15:29, Peter Lieven ha scritto: >>>>>> If the driver would have a better method of writing zeroes than >>>>>> discard it simply should not set bdi->write_zeroes_w_discard = 1. >>>>> If the driver had a better method of writing zeroes than discard, it >>>>> simply should ignore the BDRV_MAY_UNMAP (or BDRV_MAY_DISCARD) flag in >>>>> its bdrv_write_zeros implementation. >>>> ok, but this would require an individual patch in every driver, wouldn't >>>> it. i am ok with that. >>> Yes (making the drivers return the flag in the BDI would also require >>> per-driver patches). >> we still might need a hint for qemu-img convert that the driver does >> support >> writing zeroes by unmap because using write_zeroes in the main loop >> might result in unaligned requests that the target is not able to unmap. >> and to avoid writing several blocks twice by first writing all zeroes >> to the target and then writing all data blocks again I would need to >> keep the loop >> at the beginning of qemu-img convert to write zeroes with correct >> alignment and granularity if the driver supports write_zeroes_w_discard. > (Mis)alignment and granularity can be handled later. We can ignore them > for now. Later, if we decide the best way to support them is a flag, > we'll add it. Let's not put the cart before the horse. > > BTW, I expect alignment!=0 to be really, really rare. To explain my concerns: I know that my target has internal page size of 15MB. I will check what happens if I deallocate this 15MB in chunks of lets say 1MB. If the page gets unprovisioned after the last chunk is unmapped it would be fine :-) Peter