nbd: Support BDRV_REQ_FUA
commit2b556518c3424caa4f40ee4f6199e8877488f5e8
authorKevin Wolf <kwolf@redhat.com>
Thu, 10 Mar 2016 13:01:31 +0000 (10 14:01 +0100)
committerKevin Wolf <kwolf@redhat.com>
Wed, 30 Mar 2016 10:16:02 +0000 (30 12:16 +0200)
tree9684bbd86bc2f6e70a9018d6d7f3cbef76c4e25f
parent9f0eb9e129398d8907ec990b18c03f20ee0de15e
nbd: Support BDRV_REQ_FUA

The NBD server already used to send a FUA flag when the writethrough
mode was set. This code was a remnant from the times where protocol
drivers actually had to implement writethrough modes. Since nowadays the
block layer sends flushes in writethrough mode and non-root nodes are
always writeback, this was mostly dead code - only mostly because if NBD
was configured to be used without a format, we sent _both_ FUA and an
explicit flush afterwards, which makes the code not technically dead,
but useless overhead.

This patch changes the code so that the block layer's FUA flag is
recognised and translated into a NBD FUA flag. The additional flush is
avoided now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
block/nbd-client.c
block/nbd-client.h
block/nbd.c