diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-04 21:39:21 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-04 21:39:21 +0000 |
commit | 4dc822d726376fd4369089f04eb8605d2f94b74f (patch) | |
tree | 743ea1d2ed14426c2d9f3da8d48d24b14f990df0 /block-qcow2.c | |
parent | 0cd2df75a2d7223b567c0eaa2547ce6c7d6a83f7 (diff) |
Use writeback caching by default with qcow2
qcow2 writes a cluster reference count on every cluster update. This causes
performance to crater when using anything but cache=writeback. This is most
noticeable when using savevm. Right now, qcow2 isn't a reliable format
regardless of the type of cache your using because metadata is not updated in
the correct order. Considering this, I think it's somewhat reasonable to use
writeback caching by default with qcow2 files.
It at least avoids the massive performance regression for users until we sort
out the issues in qcow2.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5879 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-qcow2.c')
-rw-r--r-- | block-qcow2.c | 8 |
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; |