aboutsummaryrefslogtreecommitdiff
path: root/block-qcow2.c
diff options
context:
space:
mode:
Diffstat (limited to 'block-qcow2.c')
-rw-r--r--block-qcow2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block-qcow2.c b/block-qcow2.c
index c9d68af93f..b3b5f8f090 100644
--- a/block-qcow2.c
+++ b/block-qcow2.c
@@ -189,6 +189,14 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
int len, i, shift, ret;
QCowHeader header;
+ /* Performance is terrible right now with cache=writethrough due mainly
+ * to reference count updates. If the user does not explicitly specify
+ * a caching type, force to writeback caching.
+ */
+ if ((flags & BDRV_O_CACHE_DEF)) {
+ flags |= BDRV_O_CACHE_WB;
+ flags &= ~BDRV_O_CACHE_DEF;
+ }
ret = bdrv_file_open(&s->hd, filename, flags);
if (ret < 0)
return ret;