qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [5432] Add bdrv_flush_all()


From: Anthony Liguori
Subject: [Qemu-devel] [5432] Add bdrv_flush_all()
Date: Mon, 06 Oct 2008 13:55:44 +0000

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 <address@hidden>

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 via email to

[Prev in Thread] Current Thread [Next in Thread]