diff options
author | Juan Quintela <quintela@redhat.com> | 2017-03-14 18:41:03 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2017-04-21 12:25:38 +0200 |
commit | 96506894a316bdb86ce9b78e906bc8ffb9697d5e (patch) | |
tree | d6c5d47de11303a23d57f4c82e2c645974008296 /migration | |
parent | 47ad861976d8490047c53d5a80b562776f3c951b (diff) |
ram: Move postcopy_requests into RAMState
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/migration.c | 5 | ||||
-rw-r--r-- | migration/ram.c | 13 |
2 files changed, 11 insertions, 7 deletions
diff --git a/migration/migration.c b/migration/migration.c index e430aec80e..2990c4069c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -657,7 +657,7 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) (1ul << qemu_target_page_bits()); info->ram->mbps = s->mbps; info->ram->dirty_sync_count = ram_dirty_sync_count(); - info->ram->postcopy_requests = s->postcopy_requests; + info->ram->postcopy_requests = ram_postcopy_requests(); if (s->state != MIGRATION_STATUS_COMPLETED) { info->ram->remaining = ram_bytes_remaining(); @@ -1120,7 +1120,6 @@ MigrationState *migrate_init(const MigrationParams *params) s->setup_time = 0; s->start_postcopy = false; s->postcopy_after_devices = false; - s->postcopy_requests = 0; s->migration_thread_running = false; error_free(s->error); s->error = NULL; @@ -1480,7 +1479,7 @@ static void migrate_handle_rp_req_pages(MigrationState *ms, const char* rbname, return; } - if (ram_save_queue_pages(ms, rbname, start, len)) { + if (ram_save_queue_pages(rbname, start, len)) { mark_source_rp_bad(ms); } } diff --git a/migration/ram.c b/migration/ram.c index c5240eb39d..b9f415c09d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -214,6 +214,8 @@ struct RAMState { uint64_t bytes_transferred; /* number of dirtied pages in the last second */ uint64_t dirty_pages_rate; + /* Count of requests incoming from destination */ + uint64_t postcopy_requests; /* protects modification of the bitmap */ QemuMutex bitmap_mutex; /* Ram Bitmap protected by RCU */ @@ -283,6 +285,11 @@ uint64_t ram_dirty_pages_rate(void) return ram_state.dirty_pages_rate; } +uint64_t ram_postcopy_requests(void) +{ + return ram_state.postcopy_requests; +} + /* used by the search for pages to send */ struct PageSearchStatus { /* Current block being searched */ @@ -1240,19 +1247,17 @@ void migration_page_queue_free(void) * * Returns zero on success or negative on error * - * @ms: current migration state * @rbname: Name of the RAMBLock of the request. NULL means the * same that last one. * @start: starting address from the start of the RAMBlock * @len: length (in bytes) to send */ -int ram_save_queue_pages(MigrationState *ms, const char *rbname, - ram_addr_t start, ram_addr_t len) +int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len) { RAMBlock *ramblock; RAMState *rs = &ram_state; - ms->postcopy_requests++; + rs->postcopy_requests++; rcu_read_lock(); if (!rbname) { /* Reuse last RAMBlock */ |