[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [PATCH] Strawman proposal for NBD structured replies



On 29 Mar 2016, at 21:57, Wouter Verhelst <w@...112...> wrote:
> 
> I understand why you do it this way (we don't need 2^16 reply types),
> but (in contrast to the flags in the request packet) this makes it
> harder to specify flags and command type as separate fields (there is no
> 24-bit integer on most systems).
> 
> As said though, I understand why, and the alternative isn't ideal.

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)

>> +If the server detects an error during an operation which it
>> +is serving with a structured reply, it MUST complete
>> +the transmission of the current data chunk if transmission
>> +has started (by padding the current chunk with data
>> +which MUST be zero), after which zero or more other
>> +data chunks may be sent, followed by an `NBD_CHUNKTYPE_END`
>> +chunk. The server MAY set the offset within `NBD_CHUNKTYPE_END`
>> +to the offset of the error; if so, this MUST be within the
>> +length requested.
> 
> This should probably also be more explicit about what to do if the
> server doesn't want to set the offset (set it to zero, presumably)

Hmm. Perhaps it would be better to set the offset to 2^32-1 to
indicate "I don't know". Making this value useful is difficult in
the situation where the server is running multiple sendfiles on
multiple chunks. There could actually be multiple errors, and you
don't want the server to rely on 'data up to X' as being OK as
only one error is reported. I'd therefore suggest an error offset
of 2^32-1 means 'one or more error, assume all delivered data is
potentially erroneous'.

-- 
Alex Bligh







Reply to: