Re: [Nbd] [PATCH 3/1] doc: Propose Structured Replies extension
- To: Wouter Verhelst <w@...112...>
- Cc: "nbd-general@lists.sourceforge.net" <nbd-general@lists.sourceforge.net>, Eric Blake <eblake@...696...>, "qemu-devel@...530..." <qemu-devel@...530...>
- Subject: Re: [Nbd] [PATCH 3/1] doc: Propose Structured Replies extension
- From: Alex Bligh <alex@...872...>
- Date: Tue, 29 Mar 2016 23:53:07 +0100
- Message-id: <080DA678-32EA-4629-89CB-100EF59F8A9D@...872...>
- In-reply-to: <20160329224517.GB5466@...3...>
- References: <1459173555-4890-1-git-send-email-eblake@...696...> <1459223796-28474-2-git-send-email-eblake@...696...> <20160329175319.GA8628@...3...> <56FAC823.8070206@...696...> <20160329185157.GC12469@...3...> <C18AAD54-A6E4-43D5-AA8B-481E8D9DF752@...872...> <56FADEFA.8070207@...696...> <7E85EC50-7289-43CA-8DCC-D933B4B28A22@...872...> <20160329210545.GB19767@...3...> <044DDAC6-039B-4C29-A83F-445B4E68AB0D@...872...> <20160329224517.GB5466@...3...>
On 29 Mar 2016, at 23:45, Wouter Verhelst <w@...112...> wrote:
> Doing that requires performing a lookup to negotiated state (and a code
> branch) for every response type that can possibly be structured or
> nonstructured, and introduces exactly the two code paths that I think
> should be avoided.
>
> With what I'm suggesting, this will still be required for read requests,
> but only while we retain backwards compatibility.
OK, I *think* I've encapsulated all 3 options in the revised version I
just sent.
>From the other email:
>> As a third option then:
>>
>> Each chunk consists of the following:
>>
>> S: 32 bits, 0x668e33ef, magic (NBD_STRUCTURED_REPLY_MAGIC)
>> S: 8 bits: type
>> S: 8 bits: reserved (must be zero)
>> S: 16 bits, flags
>> S: 64 bits, handle
>> S: 32 bits, payload length S: (length bytes of payload data)
>>
>> The flags have the following meanings:
>>
>> • bits 0-15: reserved (server MUST set these to zero)
>
> That seems better in that context, yes. The reserved byte could later on
> be assigned as extra flags if need be.
Or for compatibility with NBD_CMD, it could be 2 16 bit quantities. Missed
this on v2.
> The reason why I suggested zero is that it doesn't require special-case
> code. If an error offset implies that everything beyond that offset is
> invalid, then having an offset of zero implies that the whole read is
> invalid -- which is correct if the server encountered an error, but
> doesn't know or doesn't want to say (for whatever reason) where.
I think that's wrong. As reads can be disordered, then if you get
a chunk at offset X, then a chunk at offset 0, then an end chunk
specifying an error, you (at least in theory) need to disambiguate
the two so you know whether the chunk at offset X was OK. That's
why I'm using 0xffffffff (now) to say "don't know where the error
is".
--
Alex Bligh
Reply to: