aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorCédric Le Goater <clg@redhat.com>2024-03-20 07:49:06 +0100
committerPeter Xu <peterx@redhat.com>2024-04-23 18:36:01 -0400
commit92c20b2fc5cd3b423973a65aac945a605f93142e (patch)
tree9524c3bff5439c2d8f47e87a706b01035b9bc750 /migration
parent3688fec8923101b3a44acde7f3db59b76f82b838 (diff)
downloadqemu-92c20b2fc5cd3b423973a65aac945a605f93142e.zip
qemu-92c20b2fc5cd3b423973a65aac945a605f93142e.tar.gz
qemu-92c20b2fc5cd3b423973a65aac945a605f93142e.tar.bz2
migration: Introduce ram_bitmaps_destroy()
We will use it in ram_init_bitmaps() to clear the allocated bitmaps when support for error reporting is added to memory_global_dirty_log_start(). Signed-off-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240320064911.545001-11-clg@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/ram.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 4cd4f01..f0bd714 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2438,10 +2438,23 @@ static void xbzrle_cleanup(void)
XBZRLE_cache_unlock();
}
+static void ram_bitmaps_destroy(void)
+{
+ RAMBlock *block;
+
+ RAMBLOCK_FOREACH_NOT_IGNORED(block) {
+ g_free(block->clear_bmap);
+ block->clear_bmap = NULL;
+ g_free(block->bmap);
+ block->bmap = NULL;
+ g_free(block->file_bmap);
+ block->file_bmap = NULL;
+ }
+}
+
static void ram_save_cleanup(void *opaque)
{
RAMState **rsp = opaque;
- RAMBlock *block;
/* We don't use dirty log with background snapshots */
if (!migrate_background_snapshot()) {
@@ -2458,12 +2471,7 @@ static void ram_save_cleanup(void *opaque)
}
}
- RAMBLOCK_FOREACH_NOT_IGNORED(block) {
- g_free(block->clear_bmap);
- block->clear_bmap = NULL;
- g_free(block->bmap);
- block->bmap = NULL;
- }
+ ram_bitmaps_destroy();
xbzrle_cleanup();
compress_threads_save_cleanup();