From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj0pA-0002Iu-VH for qemu-devel@nongnu.org; Thu, 24 Mar 2016 04:41:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aj0p5-0003lt-Re for qemu-devel@nongnu.org; Thu, 24 Mar 2016 04:41:00 -0400 Received: from mail-db3on0113.outbound.protection.outlook.com ([157.55.234.113]:1727 helo=emea01-db3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj0p4-0003ln-Pr for qemu-devel@nongnu.org; Thu, 24 Mar 2016 04:40:55 -0400 Date: Thu, 24 Mar 2016 11:25:52 +0300 From: Pavel Borzenkov Message-ID: <20160324082552.GB24831@phobos.sw.ru> References: <1458742562-30624-1-git-send-email-den@openvz.org> <1458742562-30624-3-git-send-email-den@openvz.org> <20160323175834.GC2467@grep.be> <20160323181454.GI4126@noname.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20160323181454.GI4126@noname.redhat.com> Subject: Re: [Qemu-devel] [Nbd] [PATCH 2/2] NBD proto: add GET_LBA_STATUS extension List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: nbd-general@lists.sourceforge.net, "Denis V. Lunev" , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , Wouter Verhelst On Wed, Mar 23, 2016 at 07:14:54PM +0100, Kevin Wolf wrote: > Am 23.03.2016 um 18:58 hat Wouter Verhelst geschrieben: > > On Wed, Mar 23, 2016 at 05:16:02PM +0300, Denis V. Lunev wrote: > > > + The type of information required by the client is passed to server in the > > > + command flags field. If the server does not implement requested type or > > > + have no means to express it, it MUST NOT return an error, but instead MUST > > > + return a single LBA status descriptor with *offset* and *length* equal to > > > + the *offset* and *length* from request, and *status* set to `0`. > > > + > > > + The following request types are currently defined for the command: > > > + > > > + 1. Block provisioning state > > > + > > > + Upon receiving an `NBD_CMD_GET_LBA_STATUS` command with command flags > > > + field set to `NBD_FLAG_GET_ALLOCATED` (0x0), the server MUST return > > > > I prefer to have a non-zero flag value. > > > > > + the provisioning state of the device. The following provisionnig states > > > + are defined for the command: > > > + > > > + - `NBD_STATE_ALLOCATED` (0x0), LBA extent is present on the block device; > > > + - `NBD_STATE_ZEROED` (0x1), LBA extent is present on the block device > > > + and contains zeroes; > > > > Presumably this should be "contains only zeroes"? > > > > Also, this may end up being a fairly expensive call for the server to > > process. Is it really useful? > > I think we need to make clear that this is meant as an optimisation and > it's always a valid option for a server to return NBD_STATE_ALLOCATED > even if the contents is zeroed. > > It is definitely useful if the server has a means to efficiently find > out the allocation status (e.g. SEEK_HOLE). In that case the client may > be able to avoid reading the block and sending it over the network, or > when making a copy, it could use it to keep the target file sparse. If > the client can't take advantage, we didn't have much overhead, so it's > fine. Yes, that was the idea. I'll add a note that the server may return NBD_STATE_ALLOCATED instead of NBD_STATE_ZEROED if it has not means to efficiently differentiate allocated blocks with zeroes from allocated blocks with non-zeroed content. > > It's less clear in a case where the server needs to read in the block > and scan its contents. It could still be a net win if the next thing the > client does is retrieving the block: The server would still have the > cost of reading the block, but it wouldn't be transferred. But when the > client doesn't follow up with a read, it's quite a bit of overhead that > we had for no benefit. Returning NBD_STATE_ALLOCATED might be more > appropriate in this case than scanning for zeros. > > Kevin > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 > _______________________________________________ > Nbd-general mailing list > Nbd-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/nbd-general