On Fri, Dec 03, 2021 at 05:14:34PM -0600, Eric Blake wrote:
 Add a new negotiation feature where the client and server agree to
use
 larger packet headers on every packet sent during transmission phase.
 This has two purposes: first, it makes it possible to perform
 operations like trim, write zeroes, and block status on more than 2^32
 bytes in a single command; this in turn requires that some structured
 replies from the server also be extended to match.  The wording chosen
 here is careful to permit a server to use either flavor in its reply
 (that is, a request less than 32-bits can trigger an extended reply,
 and conversely a request larger than 32-bits can trigger a compact
 reply). 
Following up on this original proposal with something that came out of
KVM Forum this year.
 +* `NBD_REPLY_TYPE_BLOCK_STATUS_EXT` (6)
 +
 +  This chunk type is in the status chunk category.  *length* MUST be
 +  4 + (a positive multiple of 16).  The semantics of this chunk mirror
 +  those of `NBD_REPLY_TYPE_BLOCK_STATUS`, other than the use of a
 +  larger *extent length* field, as well as added padding to ease
 +  alignment.  This chunk type MUST NOT be used unless extended headers
 +  were negotiated with `NBD_OPT_EXTENDED_HEADERS`.
 +
 +  The payload starts with:
 +
 +  32 bits, metadata context ID  
 +
 +  and is followed by a list of one or more descriptors, each with this
 +  layout:
 +
 +  64 bits, length of the extent to which the status below
 +     applies (unsigned, MUST be nonzero)  
 +  32 bits, status flags  
 +  32 bits, padding (MUST be zero) 
During KVM Forum, I had several conversations about Zoned Block
Devices (
https://zonedstorage.io/docs/linux/zbd-api), and what it
would take to expose ZBD information over NBD.  In particular,
NBD_CMD_BLOCK_STATUS sounds like a great way for advertising
information about zones (by adding several metadata contexts that can
be negotiated during NBD_OPT_SET_META_CONTEXT), except for the fact
that a zone might be larger than 32 bits in size.  So Rich Jones asked
me the question of whether my work on 64-bit extensions to the NBD
protocol could also allow for a server to advertise a metadata context
only to clients that support 64-bit extensions, at which point it can
report 64-bit offsets or lengths as needed, rather than being limited
to 32-bit status flags.
The idea definitely has merit, so I'm working on incorporating that
into my next revision for 64-bit extensions in NBD.
-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  
qemu.org | 
libvirt.org