Patchwork [03/27] savevm: Factorize ram globals reset in its own function

login
register
mail settings
Submitter Juan Quintela
Date July 24, 2012, 6:36 p.m.
Message ID <1343155012-26316-4-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/173035/
State New
Headers show

Comments

Juan Quintela - July 24, 2012, 6:36 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 arch_init.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Patch

diff --git a/arch_init.c b/arch_init.c
index f555c27..02d36ce 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -491,6 +491,14 @@  static void ram_migration_cancel(void *opaque)
     migration_end();
 }

+
+static void reset_ram_globals(void)
+{
+    last_block = NULL;
+    last_offset = 0;
+    sort_ram_list();
+}
+
 #define MAX_WAIT 50 /* ms, half buffered_file limit */

 static int ram_save_setup(QEMUFile *f, void *opaque)
@@ -499,9 +507,7 @@  static int ram_save_setup(QEMUFile *f, void *opaque)
     RAMBlock *block;

     bytes_transferred = 0;
-    last_block = NULL;
-    last_offset = 0;
-    sort_ram_list();
+    reset_ram_globals();

     if (migrate_use_xbzrle()) {
         XBZRLE.cache = cache_init(migrate_xbzrle_cache_size() /