aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2017-03-13 21:29:54 +0100
committerJuan Quintela <quintela@redhat.com>2017-04-21 12:25:37 +0200
commitceb4d16898549e5b7d9123b830907de8908fca9d (patch)
tree6250f804243c51290a2a232a2db370e103616fea /migration
parent0d8ec885ed899d20b14eb8a19544ad66f04937bc (diff)
ram: Everything was init to zero, so use memset
And then init only things that are not zero by default. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/ram.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 71f8ef3224..42bb82f8ba 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -612,15 +612,6 @@ static void migration_bitmap_sync_range(RAMState *rs, ram_addr_t start,
&rs->num_dirty_pages_period);
}
-static void migration_bitmap_sync_init(RAMState *rs)
-{
- rs->time_last_bitmap_sync = 0;
- rs->bytes_xfer_prev = 0;
- rs->num_dirty_pages_period = 0;
- rs->xbzrle_cache_miss_prev = 0;
- rs->iterations_prev = 0;
-}
-
/**
* ram_pagesize_summary: calculate all the pagesizes of a VM
*
@@ -1986,21 +1977,11 @@ err:
return ret;
}
-static int ram_save_init_globals(RAMState *rs)
+static int ram_state_init(RAMState *rs)
{
int64_t ram_bitmap_pages; /* Size of bitmap in pages, including gaps */
- rs->dirty_rate_high_cnt = 0;
- rs->bitmap_sync_count = 0;
- rs->zero_pages = 0;
- rs->norm_pages = 0;
- rs->iterations = 0;
- rs->xbzrle_bytes = 0;
- rs->xbzrle_pages = 0;
- rs->xbzrle_cache_miss = 0;
- rs->xbzrle_cache_miss_rate = 0;
- rs->xbzrle_overflows = 0;
- migration_bitmap_sync_init(rs);
+ memset(rs, 0, sizeof(*rs));
qemu_mutex_init(&migration_bitmap_mutex);
if (migrate_use_xbzrle()) {
@@ -2090,7 +2071,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
/* migration has already setup the bitmap, reuse it. */
if (!migration_in_colo_state()) {
- if (ram_save_init_globals(rs) < 0) {
+ if (ram_state_init(rs) < 0) {
return -1;
}
}