On 04/05/2016 12:17 AM, Eric Blake wrote:
> On 04/04/2016 03:04 PM, Denis V. Lunev wrote:
>> In v1 we have had 'status' field, which can have the
>> following values for dirty request:
>>
>> +      - `NBD_STATE_DIRTY` (0x0), LBA extent is dirty;
>> +      - `NBD_STATE_CLEAN` (0x1), LBA extent is clean.
>>
>> in the extent structure:
>>
>> +        * 64 bits, offset (unsigned)
>> +        * 32 bits, length (unsigned)
>> +        * 16 bits, status (unsigned)
> Between v1 and v2, we dropped 64-bit offset (offset is now implied, by
> adding lengths of all earlier descriptors), and widened status from 16
> bits to 32 bits (so that each descriptor is now naturally 8-byte aligned
> and therefore easier to make a C array).
>
>> with an additional NBD_STATE_DIRTY_HOLE or (DIRTY_DEALLOCATED)
>> we could report the entire state using one query. The user could be
>> able to read entire state which is useful for backup at once.
>>
>> Your current proposal is more tricky and it was misunderstood by Alex:
>>
>> +        * 32 bits, status flags
>>
>> and you describe flags as
>>
>> +      - `NBD_STATE_HOLE` (bit 0); if set, the block represents a hole
>> +      - `NBD_STATE_ZERO` (bit 1), if set, the block contents read as
>> +      - `NBD_STATE_CLEAN` (bit 2); if set, the block represents a
>> and opinion of Alex was that all 3 bits could be set in reply to
>> NBD_CMD_BLOCK_STATUS
>> with NBD_CMD_FLAG_STATUS_DIRTY set.
>>
>> This confused him. This confuses me too.
> There's nothing that says that NBD_STATE_CLEAN can't be reassigned to
> bit 0.  Conversely, we may want to add a future NBD_CMD_FLAG_FOO that
> lets you read allocation and dirty information in the same call, in
> which case having the bits be distinct will make that easier; but where
> we would also make it obvious that the server is allowed to reject that
> command flag as unsupported (we already state the server can reject
> NBD_CMD_FLAG_STATUS_DIRTY with EINVAL as unsupported; and that it if
> does not reject a dirtiness request but cannot otherwise report
> anything, then the entire region is reported as dirty).
>
> I don't have any strong opinions on whether NBD_STATE_CLEAN should
> remain bit 2 or be renumbered to bit 0, although renumbering it to bit 0
> would make it painfully obvious that you cannot query allocation and
> dirtiness at the same time.
I think it is worth to do to avoid this type of the confusion.

>> If allocated state is not replied to command with NBD_CMD_FLAG_STATUS_DIRTY
>> then why to have different meaning of bits.
> Because we still have room - no need to overlap the meaning of bits as
> long as we have more bits to choose from.
>
ok

------------------------------------------------------------------------------
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to