qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-stable@nongnu.org, qemu-devel@nongnu.org,
	mreitz@redhat.com, John Snow <jsnow@redhat.com>
Subject: [Qemu-devel] [PATCH v5 2/3] qemu: use bdrv_flush_all for vm_stop et al
Date: Thu, 22 Sep 2016 21:45:51 -0400	[thread overview]
Message-ID: <1474595152-4383-3-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1474595152-4383-1-git-send-email-jsnow@redhat.com>

Reimplement bdrv_flush_all for vm_stop. In contrast to blk_flush_all,
bdrv_flush_all does not have device model restrictions. This allows
us to flush and halt unconditionally without error.

This allows us to do things like migrate when we have a device with
an open tray, but has a node that may need to be flushed, or nodes
that aren't currently attached to any device and need to be flushed.

Specifically, this allows us to migrate when we have a CDROM with
an open tray.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
 cpus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpus.c b/cpus.c
index e39ccb7..96d9352 100644
--- a/cpus.c
+++ b/cpus.c
@@ -751,7 +751,7 @@ static int do_vm_stop(RunState state)
     }
 
     bdrv_drain_all();
-    ret = blk_flush_all();
+    ret = bdrv_flush_all();
 
     return ret;
 }
@@ -1494,7 +1494,7 @@ int vm_stop_force_state(RunState state)
         bdrv_drain_all();
         /* Make sure to return an error if the flush in a previous vm_stop()
          * failed. */
-        return blk_flush_all();
+        return bdrv_flush_all();
     }
 }
 
-- 
2.7.4

  parent reply	other threads:[~2016-09-23  1:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23  1:45 [Qemu-devel] [PATCH v5 0/3] block: allow flush on devices with open tray John Snow
2016-09-23  1:45 ` [Qemu-devel] [PATCH v5 1/3] block: reintroduce bdrv_flush_all John Snow
2016-09-23  1:45 ` John Snow [this message]
2016-09-23  1:45 ` [Qemu-devel] [PATCH v5 3/3] block-backend: remove blk_flush_all John Snow
2016-09-23  4:11 ` [Qemu-devel] [PATCH v5 0/3] block: allow flush on devices with open tray Fam Zheng
2016-09-23 15:35 ` Max Reitz
2016-09-23 19:38   ` John Snow
2016-09-26  8:28     ` Kevin Wolf

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=1474595152-4383-3-git-send-email-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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).