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

Re: [Nbd] NBD_CMD_FLAG_FUA?





--On 9 September 2011 13:52:24 +0200 Folkert van Heusden <folkert@...421...> wrote:

Hi,

From the patch:
  +bit 3 - NBD_FLAG_SEND_FUA
  +should be set to 1 if the server supports the NBD_CMD_FLAG_FUA flag
  ...
  +Bits 16 and above of the commands are reserved for flags.  Right
  +now, the only flag is NBD_CMD_FLAG_FUA (bit 16), "Force unit access".


From the protocol document proto.txt
The top 16 bits of the request are flags. NBD_CMD_FLAG_FUA implies
a force unit access, and can currently only be usefully combined
with NBD_CMD_WRITE. This is implemented using sync_file_range
if present, else by fdatasync() of that file (note not all files
in a multifile environment). NBD_CMD_FLAG_FUA will not be set
unless NBD_FLAG_SEND_FUA is set.

My questions:
- does it mean that I should mask of the upper 16 bit of a command and
only look at the lower 16?

Yes

- does it mean that if bit 16 bit is set, NBD_CMD_FLAG_FUA should be
performed? - what on earth is NBD_CMD_FLAG_FUA for? what should I do if i
receive that message?

You can't "perform" an NBD_CMD_FLAG_FUA, it's saying that the
command to which it is attached (which, as per above, is NBD_CMD_WRITE
only at the moment, though we'd also want to allow it on the
recent NBD_CMD_DISCARD), you treat the command as having "force
unit access" set, which means you should not acknowledge the
command as complete until the data is written to the physical disk. IE
it has the same semantics as the Linux block layer flag.

If you don't want to worry about this (for instance because you cannot
ensure that this is done), then do not set NBD_FLAG_SEND_FUA and you
won't be sent commands with the NBD_CMD_FLAG_FUA flag set.

--
Alex Bligh



Reply to: