From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzoys-00057r-4j for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:14:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uzoyq-0004HK-Kr for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:14:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40055) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzoyq-0004HF-CN for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:14:52 -0400 Message-ID: <51E7F84C.2080705@redhat.com> Date: Thu, 18 Jul 2013 16:14:36 +0200 From: Paolo Bonzini 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 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: ronnie sahlberg Cc: Kevin Wolf , Peter Lieven , qemu-devel , Stefan Hajnoczi Il 18/07/2013 15:55, ronnie sahlberg ha scritto: >> > bdrv->write_zeroes will use writesame16 and set the unmap flag only if >> > BDRV_MAY_DISCARD == 1 and BDRV_O_UNMAP == 1 and lbprz == 1. > When you use WRITESAME16 you can ignore the lbprz flag. > Just send a WRITESAME16 command with one block of data that is all set to zero. > If the unmap flag is set and if unmapped blocks read back the same as > the block you provided (all zero) > then it will unmap those blocks, where possible. True, so the unmap flag can be set iff BDRV_MAY_DISCARD == 1. block.c can take care of checking BDRV_O_UNMAP. Paolo > All other blocks that can not be unmapped, or where unmapped blocks > will not read back the same, will instead be overwritten by the > provided all-zero block. > >