[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/10] Add bdrv_flush_all()
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 3/10] Add bdrv_flush_all() |
Date: |
Tue, 9 Sep 2008 14:49:55 -0500 |
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>
diff --git a/block.c b/block.c
index 544176f..921d382 100644
--- a/block.c
+++ b/block.c
@@ -884,6 +884,21 @@ void bdrv_flush(BlockDriverState *bs)
bdrv_flush(bs->backing_hd);
}
+void bdrv_iterate_writeable(void (*it)(BlockDriverState *bs))
+{
+ 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)))
+ it(bs);
+}
+
+void bdrv_flush_all(void)
+{
+ bdrv_iterate_writeable(bdrv_flush);
+}
+
/*
* Returns true iff the specified sector is present in the disk image. Drivers
* not implementing the functionality are assumed to not support backing files,
diff --git a/block.h b/block.h
index fa741b5..8586dc1 100644
--- a/block.h
+++ b/block.h
@@ -112,6 +112,8 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t
sector_num, int nb_sectors,
#define BIOS_ATA_TRANSLATION_LARGE 3
#define BIOS_ATA_TRANSLATION_RECHS 4
+void bdrv_flush_all(void);
+
void bdrv_set_geometry_hint(BlockDriverState *bs,
int cyls, int heads, int secs);
void bdrv_set_type_hint(BlockDriverState *bs, int type);
- [Qemu-devel] [PATCH 0/10] Live migration for QEMU, Anthony Liguori, 2008/09/09
- [Qemu-devel] [PATCH 1/10] Refactor QEMUFile for live migration, Anthony Liguori, 2008/09/09
- [Qemu-devel] [PATCH 3/10] Add bdrv_flush_all(),
Anthony Liguori <=
- Re: [Qemu-devel] [PATCH 3/10] Add bdrv_flush_all(), Chris Lalancette, 2008/09/10
- Re: [Qemu-devel] [PATCH 3/10] Add bdrv_flush_all(), Glauber Costa, 2008/09/10
- Re: [Qemu-devel] [PATCH 3/10] Add bdrv_flush_all(), Anthony Liguori, 2008/09/10
- Re: [Qemu-devel] [PATCH 3/10] Add bdrv_flush_all(), Glauber Costa, 2008/09/10
- Re: [Qemu-devel] [PATCH 3/10] Add bdrv_flush_all(), Avi Kivity, 2008/09/10
- Re: [Qemu-devel] [PATCH 3/10] Add bdrv_flush_all(), Paul Brook, 2008/09/10
- Re: [Qemu-devel] [PATCH 3/10] Add bdrv_flush_all(), Blue Swirl, 2008/09/12
[Qemu-devel] [PATCH 2/10] Allow the monitor to be suspended during non-blocking op, Anthony Liguori, 2008/09/09