From patchwork Wed May 24 08:55:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 9745507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8AB4C60209 for ; Wed, 24 May 2017 08:57:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E0372886B for ; Wed, 24 May 2017 08:57:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72DC22891A; Wed, 24 May 2017 08:57:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB8482886B for ; Wed, 24 May 2017 08:57:21 +0000 (UTC) Received: from localhost ([::1]:53628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDS6b-0008OC-7J for patchwork-qemu-devel@patchwork.kernel.org; Wed, 24 May 2017 04:57:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDS4p-0007aX-Sd for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDS4m-00070S-0v for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42836) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDS4l-000702-Nf for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B80E61B91; Wed, 24 May 2017 08:55:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6B80E61B91 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6B80E61B91 Received: from secure.mitica (ovpn-117-10.ams2.redhat.com [10.36.117.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9201176D3; Wed, 24 May 2017 08:55:24 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 24 May 2017 10:55:17 +0200 Message-Id: <20170524085519.22856-2-quintela@redhat.com> In-Reply-To: <20170524085519.22856-1-quintela@redhat.com> References: <20170524085519.22856-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 24 May 2017 08:55:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/3] migration: Use savevm_handlers instead of loadvm copy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com, Juan Quintela Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Juan Quintela There is no reason for having the loadvm_handlers at all. There is only one use, and we can use the savevm handlers. We will remove the loadvm handlers on a following patch. Signed-off-by: Juan Quintela --- migration/savevm.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index d971e5e..55ac8c1 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1792,7 +1792,7 @@ struct LoadStateEntry { * Returns: true if the footer was good * false if there is a problem (and calls error_report to say why) */ -static bool check_section_footer(QEMUFile *f, LoadStateEntry *le) +static bool check_section_footer(QEMUFile *f, SaveStateEntry *se) { uint8_t read_mark; uint32_t read_section_id; @@ -1805,15 +1805,15 @@ static bool check_section_footer(QEMUFile *f, LoadStateEntry *le) read_mark = qemu_get_byte(f); if (read_mark != QEMU_VM_SECTION_FOOTER) { - error_report("Missing section footer for %s", le->se->idstr); + error_report("Missing section footer for %s", se->idstr); return false; } read_section_id = qemu_get_be32(f); - if (read_section_id != le->section_id) { + if (read_section_id != se->section_id) { error_report("Mismatched section id in footer for %s -" " read 0x%x expected 0x%x", - le->se->idstr, read_section_id, le->section_id); + se->idstr, read_section_id, se->section_id); return false; } @@ -1887,7 +1887,7 @@ qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis) " device '%s'", instance_id, idstr); return ret; } - if (!check_section_footer(f, le)) { + if (!check_section_footer(f, se)) { return -EINVAL; } @@ -1898,29 +1898,29 @@ static int qemu_loadvm_section_part_end(QEMUFile *f, MigrationIncomingState *mis) { uint32_t section_id; - LoadStateEntry *le; + SaveStateEntry *se; int ret; section_id = qemu_get_be32(f); trace_qemu_loadvm_state_section_partend(section_id); - QLIST_FOREACH(le, &mis->loadvm_handlers, entry) { - if (le->section_id == section_id) { + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { + if (se->section_id == section_id) { break; } } - if (le == NULL) { + if (se == NULL) { error_report("Unknown savevm section %d", section_id); return -EINVAL; } - ret = vmstate_load(f, le->se, le->version_id); + ret = vmstate_load(f, se, se->version_id); if (ret < 0) { error_report("error while loading state section id %d(%s)", - section_id, le->se->idstr); + section_id, se->idstr); return ret; } - if (!check_section_footer(f, le)) { + if (!check_section_footer(f, se)) { return -EINVAL; }