[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH] Make live saving stages public and use their #def
From: |
Stefan Berger |
Subject: |
[Qemu-trivial] [PATCH] Make live saving stages public and use their #defines |
Date: |
Mon, 26 Mar 2012 21:13:37 -0400 |
Make the different stages for live saving of state public and use
the #defines rather than numbers.
Signed-off-by: Stefan Berger <address@hidden>
---
arch_init.c | 7 ++++---
block-migration.c | 8 ++++----
savevm.c | 7 -------
vmstate.h | 8 ++++++++
4 files changed, 16 insertions(+), 14 deletions(-)
Index: qemu/savevm.c
===================================================================
--- qemu.orig/savevm.c
+++ qemu/savevm.c
@@ -1541,13 +1541,6 @@ static void vmstate_save(QEMUFile *f, Sa
#define QEMU_VM_FILE_VERSION_COMPAT 0x00000002
#define QEMU_VM_FILE_VERSION 0x00000003
-#define QEMU_VM_EOF 0x00
-#define QEMU_VM_SECTION_START 0x01
-#define QEMU_VM_SECTION_PART 0x02
-#define QEMU_VM_SECTION_END 0x03
-#define QEMU_VM_SECTION_FULL 0x04
-#define QEMU_VM_SUBSECTION 0x05
-
bool qemu_savevm_state_blocked(Error **errp)
{
SaveStateEntry *se;
Index: qemu/vmstate.h
===================================================================
--- qemu.orig/vmstate.h
+++ qemu/vmstate.h
@@ -31,6 +31,14 @@ typedef void SaveStateHandler(QEMUFile *
typedef int SaveLiveStateHandler(QEMUFile *f, int stage, void *opaque);
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
+/* stages of the live state handler */
+#define QEMU_VM_EOF 0x00
+#define QEMU_VM_SECTION_START 0x01
+#define QEMU_VM_SECTION_PART 0x02
+#define QEMU_VM_SECTION_END 0x03
+#define QEMU_VM_SECTION_FULL 0x04
+#define QEMU_VM_SUBSECTION 0x05
+
int register_savevm(DeviceState *dev,
const char *idstr,
int instance_id,
Index: qemu/arch_init.c
===================================================================
--- qemu.orig/arch_init.c
+++ qemu/arch_init.c
@@ -275,7 +275,7 @@ int ram_save_live(QEMUFile *f, int stage
memory_global_sync_dirty_bitmap(get_system_memory());
- if (stage == 1) {
+ if (stage == QEMU_VM_SECTION_START) {
RAMBlock *block;
bytes_transferred = 0;
last_block = NULL;
@@ -330,7 +330,7 @@ int ram_save_live(QEMUFile *f, int stage
}
/* try transferring iterative blocks of memory */
- if (stage == 3) {
+ if (stage == QEMU_VM_SECTION_END) {
int bytes_sent;
/* flush all remaining blocks regardless of rate limiting */
@@ -344,7 +344,8 @@ int ram_save_live(QEMUFile *f, int stage
expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
- return (stage == 2) && (expected_time <= migrate_max_downtime());
+ return (stage == QEMU_VM_SECTION_PART) &&
+ (expected_time <= migrate_max_downtime());
}
static inline void *host_from_stream_offset(QEMUFile *f,
Index: qemu/block-migration.c
===================================================================
--- qemu.orig/block-migration.c
+++ qemu/block-migration.c
@@ -554,7 +554,7 @@ static int block_save_live(QEMUFile *f,
return 1;
}
- if (stage == 1) {
+ if (stage == QEMU_VM_SECTION_START) {
init_blk_migration(f);
/* start track dirty blocks */
@@ -571,7 +571,7 @@ static int block_save_live(QEMUFile *f,
blk_mig_reset_dirty_cursor();
- if (stage == 2) {
+ if (stage == QEMU_VM_SECTION_PART) {
/* control the rate of transfer */
while ((block_mig_state.submitted +
block_mig_state.read_done) * BLOCK_SIZE <
@@ -599,7 +599,7 @@ static int block_save_live(QEMUFile *f,
}
}
- if (stage == 3) {
+ if (stage == QEMU_VM_SECTION_END) {
/* we know for sure that save bulk is completed and
all async read completed */
assert(block_mig_state.submitted == 0);
@@ -620,7 +620,7 @@ static int block_save_live(QEMUFile *f,
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
- return ((stage == 2) && is_stage2_completed());
+ return ((stage == QEMU_VM_SECTION_PART) && is_stage2_completed());
}
static int block_load(QEMUFile *f, void *opaque, int version_id)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-trivial] [PATCH] Make live saving stages public and use their #defines,
Stefan Berger <=