[Nbd] NBD_CMD_FLAG_FUA
>From proto.md:
> If the NBD_FLAG_SEND_FUA flag ("Force Unit Access") was set in the export flags field, the client MAY set the flag NBD_CMD_FLAG_FUA in the command flags field. If this flag was set, the server MUST NOT send the reply until it has ensured that the newly-written data has reached permanent storage.
NBD_CMD_FLAG_FUA itself is not defined in proto.md
nbd.h has:
#define NBD_CMD_FLAG_FUA (1<<16)
This is a bit odd as the command flags are only 16 bits long!
I think I may be the only person who has ever implemented a server side FUA, but I think this is a legacy of when commands were originally 32 bits long and we broke 16 bits off for flags.
Archeological evidence for this is as follows. In my server I have:
rc->fua = !!(ntohl (req->command) & NBD_CMD_FLAG_FUA);
Where req is:
struct nbd_request
{
uint32_t magic;
uint32_t command;
uint64_t handle;
uint64_t offset;
uint32_t len;
} __attribute__ ((packed));
Now flags are a separate field (and command is 16 bits), I think we should have in nbd.h
#define NBD_CMD_FLAG_FUA (1<<0)
and this should also be in proto.md.
Wouter: would you take a patch?
--
Alex Bligh
Reply to: