summaryrefslogtreecommitdiffstats
path: root/block/io.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-03-10 13:39:55 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 20:01:34 -0600
commit0231c2e38d39ac8df46036136a12f5f1fea25d3b (patch)
tree8f3d4110039ffc6c8a12ecefb02323bd3aaf46a2 /block/io.c
parent1fc674c72f691021202dbddf2b800c64fc72ae60 (diff)
downloadhqemu-0231c2e38d39ac8df46036136a12f5f1fea25d3b.zip
hqemu-0231c2e38d39ac8df46036136a12f5f1fea25d3b.tar.gz
block: Introduce bdrv_co_writev_flags()
This function will allow drivers to implement BDRV_REQ_FUA natively instead of sending a separate flush after the write. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r--block/io.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/block/io.c b/block/io.c
index 939e4f1..c4869b9 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1154,13 +1154,20 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,
} else if (flags & BDRV_REQ_ZERO_WRITE) {
bdrv_debug_event(bs, BLKDBG_PWRITEV_ZERO);
ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags);
+ } else if (drv->bdrv_co_writev_flags) {
+ bdrv_debug_event(bs, BLKDBG_PWRITEV);
+ ret = drv->bdrv_co_writev_flags(bs, sector_num, nb_sectors, qiov,
+ flags);
} else {
+ assert(drv->supported_write_flags == 0);
bdrv_debug_event(bs, BLKDBG_PWRITEV);
ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
}
bdrv_debug_event(bs, BLKDBG_PWRITEV_DONE);
- if (ret == 0 && (flags & BDRV_REQ_FUA)) {
+ if (ret == 0 && (flags & BDRV_REQ_FUA) &&
+ !(drv->supported_write_flags & BDRV_REQ_FUA))
+ {
ret = bdrv_co_flush(bs);
}
OpenPOWER on IntegriCloud