qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5432] Add bdrv_flush_all()
Date: Mon, 06 Oct 2008 13:55:44 +0000	[thread overview]
Message-ID: <E1KmqYq-0007TY-An@cvs.savannah.gnu.org> (raw)

Revision: 5432
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5432
Author:   aliguori
Date:     2008-10-06 13:55:43 +0000 (Mon, 06 Oct 2008)

Log Message:
-----------
Add bdrv_flush_all()

This patch adds a bdrv_flush_all() function.  It's necessary to ensure that all
IO operations have been flushed to disk before completely a live migration.

N.B. we don't actually use this now.  We really should flush the block drivers
using an live savevm callback to avoid unnecessary guest down time.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Modified Paths:
--------------
    trunk/block.c
    trunk/block.h

Modified: trunk/block.c
===================================================================
--- trunk/block.c	2008-10-06 13:52:44 UTC (rev 5431)
+++ trunk/block.c	2008-10-06 13:55:43 UTC (rev 5432)
@@ -895,6 +895,16 @@
         bdrv_flush(bs->backing_hd);
 }
 
+void bdrv_flush_all(void)
+{
+    BlockDriverState *bs;
+
+    for (bs = bdrv_first; bs != NULL; bs = bs->next)
+        if (bs->drv && !bdrv_is_read_only(bs) && 
+            (!bdrv_is_removable(bs) || bdrv_is_inserted(bs)))
+            bdrv_flush(bs);
+}
+
 /*
  * Returns true iff the specified sector is present in the disk image. Drivers
  * not implementing the functionality are assumed to not support backing files,

Modified: trunk/block.h
===================================================================
--- trunk/block.h	2008-10-06 13:52:44 UTC (rev 5431)
+++ trunk/block.h	2008-10-06 13:55:43 UTC (rev 5432)
@@ -93,6 +93,8 @@
 
 /* Ensure contents are flushed to disk.  */
 void bdrv_flush(BlockDriverState *bs);
+void bdrv_flush_all(void);
+
 int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
 	int *pnum);
 

                 reply	other threads:[~2008-10-06 13:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1KmqYq-0007TY-An@cvs.savannah.gnu.org \
    --to=anthony@codemonkey.ws \
    --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).