qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT 0aa217e] qcow2: Make cache=writethrough default


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 0aa217e] qcow2: Make cache=writethrough default
Date: Fri, 10 Jul 2009 19:16:39 -0000

From: Kevin Wolf <address@hidden>

The performance of qcow2 has improved meanwhile, so we don't need to
special-case it any more. Switch the default to write-through caching
like all other block drivers.

Signed-off-by: Kevin Wolf <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/block.h b/block.h
index b595772..ca5bfff 100644
--- a/block.h
+++ b/block.h
@@ -37,9 +37,8 @@ typedef struct QEMUSnapshotInfo {
                                      bdrv_file_open()) */
 #define BDRV_O_NOCACHE     0x0020 /* do not use the host page cache */
 #define BDRV_O_CACHE_WB    0x0040 /* use write-back caching */
-#define BDRV_O_CACHE_DEF   0x0080 /* use default caching */
 
-#define BDRV_O_CACHE_MASK  (BDRV_O_NOCACHE | BDRV_O_CACHE_WB | 
BDRV_O_CACHE_DEF)
+#define BDRV_O_CACHE_MASK  (BDRV_O_NOCACHE | BDRV_O_CACHE_WB)
 
 void bdrv_info(Monitor *mon);
 void bdrv_info_stats(Monitor *mon);
diff --git a/block/qcow2.c b/block/qcow2.c
index 20c114b..9a7c666 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -145,14 +145,6 @@ static int qcow_open(BlockDriverState *bs, const char 
*filename, int flags)
     QCowHeader header;
     uint64_t ext_end;
 
-    /* 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;
diff --git a/qemu-options.hx b/qemu-options.hx
index 8947d05..cadc822 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -148,9 +148,7 @@ an internal copy of the data.
 
 Some block drivers perform badly with @option{cache=writethrough}, most 
notably,
 qcow2.  If performance is more important than correctness,
address@hidden should be used with qcow2.  By default, if no explicit
-caching is specified for a qcow2 disk image, @option{cache=writeback} will be
-used.  For all other disk types, @option{cache=writethrough} is the default.
address@hidden should be used with qcow2.
 
 Instead of @option{-cdrom} you can use:
 @example
diff --git a/vl.c b/vl.c
index 7b7489c..5189ad5 100644
--- a/vl.c
+++ b/vl.c
@@ -2239,7 +2239,7 @@ int drive_init(struct drive_opt *arg, int snapshot, void 
*opaque)
     unit_id = -1;
     translation = BIOS_ATA_TRANSLATION_AUTO;
     index = -1;
-    cache = 3;
+    cache = 1;
 
     if (machine->use_scsi) {
         type = IF_SCSI;
@@ -2557,8 +2557,6 @@ int drive_init(struct drive_opt *arg, int snapshot, void 
*opaque)
         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) {
         fprintf(stderr, "qemu: could not open disk image %s\n",
                         file);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]