qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block-raw: Make cache=off default again
@ 2009-06-22 11:18 Kevin Wolf
  2009-06-22 11:35 ` Christoph Hellwig
  2009-06-22 13:08 ` Anthony Liguori
  0 siblings, 2 replies; 19+ messages in thread
From: Kevin Wolf @ 2009-06-22 11:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf

Since the patch that suggested it woudl revert qcow2 to writeback caching, in
fact none of the drivers has had cache=off as default any more. This patch
restores the desired behaviour.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/raw-posix.c |    4 ++++
 block/raw-win32.c |    8 ++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index fa1a394..513e8e8 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -143,6 +143,10 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
 
     /* Use O_DSYNC for write-through caching, no flags for write-back caching,
      * and O_DIRECT for no caching. */
+    if (bdrv_flags & BDRV_O_CACHE_DEF) {
+        bdrv_flags = (bdrv_flags & ~BDRV_O_CACHE_MASK) | BDRV_O_NOCACHE;
+    }
+
     if ((bdrv_flags & BDRV_O_NOCACHE))
         s->open_flags |= O_DIRECT;
     else if (!(bdrv_flags & BDRV_O_CACHE_WB))
diff --git a/block/raw-win32.c b/block/raw-win32.c
index 72acad5..5da957c 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -92,6 +92,10 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
         create_flags = OPEN_EXISTING;
     }
     overlapped = FILE_ATTRIBUTE_NORMAL;
+
+    if (flags & BDRV_O_CACHE_DEF) {
+        flags = (flags & ~BDRV_O_CACHE_MASK) | BDRV_O_NOCACHE;
+    }
     if ((flags & BDRV_O_NOCACHE))
         overlapped |= FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH;
     else if (!(flags & BDRV_O_CACHE_WB))
@@ -345,6 +349,10 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
     create_flags = OPEN_EXISTING;
 
     overlapped = FILE_ATTRIBUTE_NORMAL;
+
+    if (flags & BDRV_O_CACHE_DEF) {
+        flags = (flags & ~BDRV_O_CACHE_MASK) | BDRV_O_NOCACHE;
+    }
     if ((flags & BDRV_O_NOCACHE))
         overlapped |= FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH;
     else if (!(flags & BDRV_O_CACHE_WB))
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2009-06-25  7:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-22 11:18 [Qemu-devel] [PATCH] block-raw: Make cache=off default again Kevin Wolf
2009-06-22 11:35 ` Christoph Hellwig
2009-06-22 11:44   ` Kevin Wolf
2009-06-22 11:55     ` Avi Kivity
2009-06-22 12:32       ` Kevin Wolf
2009-06-22 12:39         ` Avi Kivity
2009-06-22 12:50           ` Kevin Wolf
2009-06-23 10:30             ` Jamie Lokier
2009-06-23 11:46               ` Kevin Wolf
2009-06-24 21:23                 ` Jamie Lokier
2009-06-25  7:31                   ` Kevin Wolf
2009-06-22 13:04     ` Christoph Hellwig
2009-06-22 13:05       ` Kevin Wolf
2009-06-22 13:14       ` Avi Kivity
2009-06-22 13:08 ` Anthony Liguori
2009-06-22 13:20   ` Kevin Wolf
2009-06-22 14:00     ` Anthony Liguori
2009-06-22 13:23   ` Dor Laor
2009-06-22 13:29     ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).