qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [5432] Add bdrv_flush_all()
@ 2008-10-06 13:55 Anthony Liguori
  0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2008-10-06 13:55 UTC (permalink / raw)
  To: qemu-devel

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);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-06 13:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-06 13:55 [Qemu-devel] [5432] Add bdrv_flush_all() Anthony Liguori

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).