summaryrefslogtreecommitdiffstats
path: root/block/io.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-03-04 14:28:01 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 20:01:34 -0600
commitcdc4827286034b63ae84ad34f762133a698915f7 (patch)
tree3075061d8701a9a1e796372456fc40f8a60c0bbe /block/io.c
parenta0dba62b0ca3070700e713580a3c6765130d448a (diff)
downloadhqemu-cdc4827286034b63ae84ad34f762133a698915f7.zip
hqemu-cdc4827286034b63ae84ad34f762133a698915f7.tar.gz
block: Move enable_write_cache to BB level
Whether a write cache is used or not is a decision that concerns the user (e.g. the guest device) rather than the backend. It was already logically part of the BB level as bdrv_move_feature_fields() always kept it on top of the BDS tree; with this patch, the core of it (the actual flag and the additional flushes) is also implemented there. Direct callers of bdrv_open() must pass BDRV_O_CACHE_WB now if bs doesn't have a BlockBackend attached. 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/io.c b/block/io.c
index b588435..939e4f1 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1160,7 +1160,7 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,
}
bdrv_debug_event(bs, BLKDBG_PWRITEV_DONE);
- if (ret == 0 && !bs->enable_write_cache) {
+ if (ret == 0 && (flags & BDRV_REQ_FUA)) {
ret = bdrv_co_flush(bs);
}
OpenPOWER on IntegriCloud