From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5839] qemu-img: open files with cache=writeback
Date: Sun, 30 Nov 2008 19:12:50 +0000 [thread overview]
Message-ID: <E1L6ris-0005Tm-5l@cvs.savannah.gnu.org> (raw)
Revision: 5839
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5839
Author: aurel32
Date: 2008-11-30 19:12:49 +0000 (Sun, 30 Nov 2008)
Log Message:
-----------
qemu-img: open files with cache=writeback
Data integrity is not important in qemu-img, so open the files with
cache=writeback. This fixes the performance regression seen with qemu-img
since revision 5485, and most particularly with the qcow2 format.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Revision Links:
--------------
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5485
Modified Paths:
--------------
trunk/qemu-img.c
Modified: trunk/qemu-img.c
===================================================================
--- trunk/qemu-img.c 2008-11-30 17:54:28 UTC (rev 5838)
+++ trunk/qemu-img.c 2008-11-30 19:12:49 UTC (rev 5839)
@@ -30,6 +30,9 @@
#include <windows.h>
#endif
+/* Default to cache=writeback as data integrity is not important for qemu-tcg. */
+#define BRDV_O_FLAGS BDRV_O_CACHE_WB
+
static void __attribute__((noreturn)) error(const char *fmt, ...)
{
va_list ap;
@@ -186,7 +189,7 @@
} else {
drv = NULL;
}
- if (bdrv_open2(bs, filename, 0, drv) < 0) {
+ if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv) < 0) {
error("Could not open '%s'", filename);
}
if (bdrv_is_encrypted(bs)) {
@@ -317,7 +320,7 @@
} else {
drv = NULL;
}
- if (bdrv_open2(bs, filename, 0, drv) < 0) {
+ if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv) < 0) {
error("Could not open '%s'", filename);
}
ret = bdrv_commit(bs);
@@ -691,7 +694,7 @@
} else {
drv = NULL;
}
- if (bdrv_open2(bs, filename, 0, drv) < 0) {
+ if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv) < 0) {
error("Could not open '%s'", filename);
}
bdrv_get_format(bs, fmt_name, sizeof(fmt_name));
next reply other threads:[~2008-11-30 19:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-30 19:12 Aurelien Jarno [this message]
2008-11-30 22:56 ` [Qemu-devel] [5839] qemu-img: open files with cache=writeback Anthony Liguori
2008-11-30 23:47 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1L6ris-0005Tm-5l@cvs.savannah.gnu.org \
--to=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.