On 24/03/2016 16:25, Eric Blake wrote: >> However, let's make these bits, so that >> >> NBD_STATE_ALLOCATED (0x1), LBA extent is present on the block device >> NBD_STATE_ZERO (0x2), LBA extent will read as zeroes > > Should we flip the sense and call this NBD_STATE_UNALLOCATED (0 means > allocated, 1 means not present), so that an overall status of 0 is a > safe default? Double negations are evil (and don't work the same in all languages), so I think it's a worse option. >> An implementation that doesn't track the "dirtiness" state of blocks >> MUST either fail this command with EINVAL, or mark all blocks as >> dirty in the descriptor that it returns. > > Is it feasible to return zero/allocated/dirty status all at the same > time, or do we want to strictly require two different modes of > operation? I think we should differentiate them, because it makes sense to support only one. In particular, while it is more or less obvious that (in my proposal above) a trivial implementation must return NBD_STATE_ALLOCATED, it is quite weird to require a trivial implementation to return NBD_STATE_ALLOCATED|NBD_STATE_DIRTY. Paolo > That is, if we are returning zero and allocated as two bits, > can we also return a third bit for dirty/clean? Should we flip the > sense of the bit, where 0 means dirty and 1 means clean, again so that a > server can always return a status of 0 as the safe default? >