From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, avi@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] block: Handle cache=unsafe only in raw-posix/win32
Date: Fri, 21 Oct 2011 19:08:32 +0200 [thread overview]
Message-ID: <1319216912-26964-3-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1319216912-26964-1-git-send-email-kwolf@redhat.com>
The expected meaning of cache=unsafe with qcow2 is that on a flush the metadata
caches are written out, but no fsync is performed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 4 +---
block/raw-posix.c | 4 ++++
block/raw-win32.c | 4 ++++
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 11c7f91..0b7bc06 100644
--- a/block.c
+++ b/block.c
@@ -2908,9 +2908,7 @@ static void coroutine_fn bdrv_flush_co_entry(void *opaque)
int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
{
- if (bs->open_flags & BDRV_O_NO_FLUSH) {
- return 0;
- } else if (!bs->drv) {
+ if (!bs->drv) {
return 0;
} else if (bs->drv->bdrv_co_flush) {
return bs->drv->bdrv_co_flush(bs);
diff --git a/block/raw-posix.c b/block/raw-posix.c
index dcae88a..9a3d3af 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -380,6 +380,10 @@ static int raw_co_flush(BlockDriverState *bs)
.coroutine = qemu_coroutine_self(),
};
+ if (bs->open_flags & BDRV_O_NO_FLUSH) {
+ return 0;
+ }
+
ret = fd_open(bs);
if (ret < 0) {
return ret;
diff --git a/block/raw-win32.c b/block/raw-win32.c
index f5f73bc..37a8bdb 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -156,6 +156,10 @@ static int raw_flush(BlockDriverState *bs)
BDRVRawState *s = bs->opaque;
int ret;
+ if (bs->open_flags & BDRV_O_NO_FLUSH) {
+ return 0;
+ }
+
ret = FlushFileBuffers(s->hfile);
if (ret == 0) {
return -EIO;
--
1.7.6.4
next prev parent reply other threads:[~2011-10-21 18:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 17:08 [Qemu-devel] [PATCH 0/2] block: Write out internal caches even with cache=unsafe Kevin Wolf
2011-10-21 17:08 ` [Qemu-devel] [PATCH 1/2] raw-posix: Convert to bdrv_co_flush Kevin Wolf
2011-10-21 17:08 ` Kevin Wolf [this message]
2011-10-21 18:44 ` [Qemu-devel] [PATCH 0/2] block: Write out internal caches even with cache=unsafe Paolo Bonzini
2011-10-22 15:07 ` Alexander Graf
2011-10-23 14:33 ` Paolo Bonzini
2011-10-24 8:05 ` Kevin Wolf
2011-10-24 7:37 ` Kevin Wolf
2011-10-24 7:53 ` Paolo Bonzini
2011-10-24 8:17 ` Kevin Wolf
2011-10-24 8:47 ` Paolo Bonzini
2011-10-24 8:54 ` Kevin Wolf
2011-10-24 9:26 ` Paolo Bonzini
2011-10-24 9:36 ` Kevin Wolf
2011-10-24 9:40 ` Paolo Bonzini
2011-10-24 9:53 ` Kevin Wolf
2011-10-24 10:08 ` Paolo Bonzini
2011-10-24 9:09 ` Peter Maydell
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=1319216912-26964-3-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=avi@redhat.com \
--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 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).