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
This commit is contained in:
aliguori 2008-12-04 21:39:21 +00:00
parent 0cd2df75a2
commit 4dc822d726
4 changed files with 19 additions and 2 deletions

4
vl.c
View file

@ -2242,7 +2242,7 @@ static int drive_init(struct drive_opt *arg, int snapshot,
unit_id = -1;
translation = BIOS_ATA_TRANSLATION_AUTO;
index = -1;
cache = 1;
cache = 3;
if (machine->use_scsi) {
type = IF_SCSI;
@ -2517,6 +2517,8 @@ static int drive_init(struct drive_opt *arg, int snapshot,
bdrv_flags |= BDRV_O_NOCACHE;
else if (cache == 2) /* write-back */
bdrv_flags |= BDRV_O_CACHE_WB;
else if (cache == 3) /* not specified */
bdrv_flags |= BDRV_O_CACHE_DEF;
if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0 || qemu_key_check(bdrv, file)) {
fprintf(stderr, "qemu: could not open disk image %s\n",
file);