From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzodo-0003IT-Lu for qemu-devel@nongnu.org; Thu, 18 Jul 2013 09:53:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uzodn-0005Bi-EJ for qemu-devel@nongnu.org; Thu, 18 Jul 2013 09:53:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25343) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzodn-0005BY-4d for qemu-devel@nongnu.org; Thu, 18 Jul 2013 09:53:07 -0400 Message-ID: <51E7F332.9020607@redhat.com> Date: Thu, 18 Jul 2013 15:52:50 +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: <51E7EDD0.6050001@kamp.de> 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: Peter Lieven Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel , ronnie sahlberg 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). BDRV_MAY_UNMAP is an advisory flag, that the driver is free to ignore (just like bdrv_discard can be ignored altogether). block.c probably should avoid passing down BDRV_MAY_UNMAP altogether if the BDRV_O_UNMAP flag is not set. > the BDRV_MAY_DISCARD flag is at the end a hint if the driver can optimize > writing zeroes by a discard or if real zeroes should be written e.g. to > sanitize the device? > > talking for iscsi: > bdrv->discard can remain to use UNMAP and silently fail if lbpu == 0. > 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. > in case lbpws == 0 it will return -ENOSUP. Almost: for LBPWS == 0 it can use WRITE SAME(16) without the unmap flag. If that doesn't work either it can return -ENOTSUP. Paolo > > Correct? > > Peter >