From 7f7a44f29aed0769a00d904851dd7df0c2b47633 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Tue, 20 Jul 2010 17:38:28 -0300 Subject: [PATCH 18/24] savevm: Reset last block info at beginning of each save RH-Author: Alex Williamson Message-id: <20100720173546.11297.7925.stgit@localhost6.localdomain6> Patchwork-id: 10855 O-Subject: [rhel6.0 qemu-kvm PATCH] savevm: Reset last block info at beginning of each save Bugzilla: 616525 RH-Acked-by: Kevin Wolf RH-Acked-by: Jes Sorensen RH-Acked-by: Amit Shah Bugzilla: 616525 Upstream status: posted RHEL Notes: Depends on patch series for bz596328 If we save more than once we need to reset the last block info or else only the first save has the actual block info and each subsequent save will only use continue flags, making them unloadable independently. Found-by: Miguel Di Ciurcio Filho Signed-off-by: Alex Williamson --- vl.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Signed-off-by: Eduardo Habkost --- vl.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index b871327..eb7fb60 100644 --- a/vl.c +++ b/vl.c @@ -3046,10 +3046,11 @@ static int is_dup_page(uint8_t *page, uint8_t ch) return 1; } +static RAMBlock *last_block; +static ram_addr_t last_offset; + static int ram_save_block(QEMUFile *f) { - static RAMBlock *last_block = NULL; - static ram_addr_t last_offset = 0; RAMBlock *block = last_block; ram_addr_t offset = last_offset; ram_addr_t current_addr; @@ -3180,6 +3181,8 @@ static int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) if (stage == 1) { RAMBlock *block; bytes_transferred = 0; + last_block = NULL; + last_offset = 0; /* Make sure all dirty bits are set */ QLIST_FOREACH(block, &ram_list.blocks, next) { -- 1.7.0.3