From patchwork Tue Oct 2 11:33:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 188494 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AD1182C0089 for ; Tue, 2 Oct 2012 22:50:33 +1000 (EST) Received: from localhost ([::1]:50664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ0kX-0007Nb-TY for incoming@patchwork.ozlabs.org; Tue, 02 Oct 2012 07:34:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ0jc-0005cS-W1 for qemu-devel@nongnu.org; Tue, 02 Oct 2012 07:34:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ0jW-0007bA-KW for qemu-devel@nongnu.org; Tue, 02 Oct 2012 07:33:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ0jW-0007au-BA for qemu-devel@nongnu.org; Tue, 02 Oct 2012 07:33:50 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q92BXnGq017913 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 2 Oct 2012 07:33:49 -0400 Received: from trasno.mitica (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q92BXbab001633; Tue, 2 Oct 2012 07:33:48 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 2 Oct 2012 13:33:03 +0200 Message-Id: <1349177616-5341-9-git-send-email-quintela@redhat.com> In-Reply-To: <1349177616-5341-1-git-send-email-quintela@redhat.com> References: <1349177616-5341-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 08/41] savevm: Factorize ram globals reset in its own function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela Reviewed-by: Paolo Bonzini Reviewed-by: Orit Wasserman --- arch_init.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch_init.c b/arch_init.c index 3fddb38..6b9f949 100644 --- a/arch_init.c +++ b/arch_init.c @@ -481,6 +481,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) @@ -489,9 +497,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() /