From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ainJ9-00010U-La for qemu-devel@nongnu.org; Wed, 23 Mar 2016 14:15:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ainJ4-0003ES-Mp for qemu-devel@nongnu.org; Wed, 23 Mar 2016 14:15:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42248) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ainJ4-0003EE-Ev for qemu-devel@nongnu.org; Wed, 23 Mar 2016 14:14:58 -0400 Date: Wed, 23 Mar 2016 19:14:54 +0100 From: Kevin Wolf Message-ID: <20160323181454.GI4126@noname.redhat.com> References: <1458742562-30624-1-git-send-email-den@openvz.org> <1458742562-30624-3-git-send-email-den@openvz.org> <20160323175834.GC2467@grep.be> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WYTEVAkct0FjGQmd" Content-Disposition: inline In-Reply-To: <20160323175834.GC2467@grep.be> 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: Wouter Verhelst Cc: nbd-general@lists.sourceforge.net, "Denis V. Lunev" , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini --WYTEVAkct0FjGQmd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 ty= pe or > > + have no means to express it, it MUST NOT return an error, but inst= ead MUST > > + return a single LBA status descriptor with *offset* and *length* e= qual 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 fl= ags > > + field set to `NBD_FLAG_GET_ALLOCATED` (0x0), the server MUST return >=20 > I prefer to have a non-zero flag value. >=20 > > + the provisioning state of the device. The following provisionnig s= tates > > + are defined for the command: > > + > > + - `NBD_STATE_ALLOCATED` (0x0), LBA extent is present on the bloc= k device; > > + - `NBD_STATE_ZEROED` (0x1), LBA extent is present on the block d= evice > > + and contains zeroes; >=20 > Presumably this should be "contains only zeroes"? >=20 > 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. 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 --WYTEVAkct0FjGQmd Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJW8t0eAAoJEH8JsnLIjy/WvToQALp0Bh/I3eVlkN8FjMJaQRio QO6wzH5t3vBPQPD+ftTu0so2ajzka0osULQKWT6GxBGHKdaf7scxXbk5awVcwU8K Kb7ll6AciDjO4MaWgtzWLTtWovoik0StqBSaHDIfGnN4fw3mDp4OTW4RyFsVOnbT U3xLWGsuM7DjGsfCDWA/kMf2EzzmojwlmnBpn/KI2CuVYJK75G2bukpYuA4Cp/Hl RzkWS0o3VqHOr1XCV44trVj5PzU6RSugEb5RmqVnHfhltQeZo3OM4SFImqNlWcjK a8c1Yk8gXAP95pCu0fTDaZe19AJ29/1ihkzxIqCM6dPOZfNzNgy29HYi+SMs9/UL jDJIjCoeefsgiYxZjRZF9g/zJm3VHA9kfuetAk+UsvR1ik+8RQZYSdQTvbCewq+8 vEKQxf2R2Ep7d5ArQStCjejau5aIKZTbafN6JDKn0zBwM2otcdgq+uQMuyrayPey uec4YM349ZvplRVjsjWy20fTTKdUFc0Pv1lreZ8PRDl8ilJmJCczMyU1F57IXcwS 6z9bP4/WHI6Fy1kUOxV2v0RzRRx/jfZyba1qaFe8cylEaKawaHqF383MmTzFZAPh IlBPbf/b+dH+7gxsUSB/OqukJ02VgjAf2WeUK4VK2Lcb78/W9FrIqTOS5ON15emF osACrbxkNvC4aYr6ssgI =l8jb -----END PGP SIGNATURE----- --WYTEVAkct0FjGQmd--