From patchwork Fri Feb 3 15:23:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Butsykin X-Patchwork-Id: 9554433 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 ECBDC604E2 for ; Fri, 3 Feb 2017 15:38:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9CC2283F7 for ; Fri, 3 Feb 2017 15:38:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE3A828427; Fri, 3 Feb 2017 15:38:53 +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.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 E571C283F7 for ; Fri, 3 Feb 2017 15:38:51 +0000 (UTC) Received: from localhost ([::1]:35341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZfwo-0008Pw-U6 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 03 Feb 2017 10:38:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZfwA-0008Of-MG for qemu-devel@nongnu.org; Fri, 03 Feb 2017 10:38:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZfw7-0002hZ-K0 for qemu-devel@nongnu.org; Fri, 03 Feb 2017 10:38:10 -0500 Received: from mail-db5eur01on0091.outbound.protection.outlook.com ([104.47.2.91]:60083 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZfw7-0002hF-7z for qemu-devel@nongnu.org; Fri, 03 Feb 2017 10:38:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=n+kMtnUCG47IeteymvKyUukYlcvfkHq0z0mQIhNAurk=; b=E3+M9pUvs49Z5Yi/AKL12D6YD4eZhtHdy8OBIybrc9Fcs7gJ5iz7fhrk8C07EGrYBWkfcQq/ap2Io3virirU7waroTvMePx5WFD7a+rTQ+V5XztKCEFhNkkoZ3Y50cAxQwn0Vs8kwRkfyeiAe6gHka1XhO2q+hiEK5CLurT/jQ8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pbutsykin@virtuozzo.com; Received: from pavelb-Z68P-DS3.sw.ru (195.214.232.6) by VI1PR0802MB2559.eurprd08.prod.outlook.com (10.172.255.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Fri, 3 Feb 2017 15:23:38 +0000 From: Pavel Butsykin To: Date: Fri, 3 Feb 2017 18:23:19 +0300 Message-ID: <20170203152321.19739-2-pbutsykin@virtuozzo.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170203152321.19739-1-pbutsykin@virtuozzo.com> References: <20170203152321.19739-1-pbutsykin@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: VI1PR0901CA0084.eurprd09.prod.outlook.com (10.167.203.180) To VI1PR0802MB2559.eurprd08.prod.outlook.com (10.172.255.137) X-MS-Office365-Filtering-Correlation-Id: 306b7c8a-267b-4ddf-875b-08d44c48a119 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:VI1PR0802MB2559; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2559; 3:4mzlvzi67WRDRMmHuUsaZlCZyp32zQ2GxxuBo/XCsZV7hyPoGQaW7UMTp9SQslJ9M9vSn0y3ciKOq0KU05dC7FIOsaZr1bfTKzgceEwXWb4XlusKclByTfAfSj6/+zpohejKIex2No9OllOyFBnAdEVv9nMB14WDrTQ6GVnco3vc1W17Yf/Yvod+kIXmQ/kyYlLBGEp0uAq+NhDDXm/SFIVUdJaUSQ72d8dUKcT0MdhOZkFlN5NdvWkmDyqgc2AIIGtvNGiyWYaYtPPs798Qqw==; 25:Dcvin/E2atEv9ddzjoawKsDtYFgvgIiVTP5A/izShDM4AvloHKc9TN8xtGX8sMdiqHMjmXBZftmwugTPXAgpdYtr3vVIbW19tH02YLCmPVmQ3I4Gic59nHZgYqTlituoCWYeLg8LMps2XWCOjNQU2ARGC2JL+eaJNb2ZOkZqFXhsxTtjQk2LdDmfvnxnEwCionAoZSm63B/z/eN0uOv3wfNMCs9zDL4a3iXWN2Ze8Q6j7/Uj1TBi2Ad3OVBPH6f5x7BHuGD9px4ObqNLMIxp66jT1hNNIo5Zi/6ke98Sfsxr2XqM/IhTWNYPAOClEldInaeU/XfCHTkIzyxy3w3T0D6GJem8qJx3DBYSp1bp4aDBo0/wKIlVJsE1y3+An9Yz58YAxMYDN88cTosXV7OEDzS9zkKZO5GhR3r/cnMiuMl4+H2HqJilnfTQsxewIRNx6aLKy8DOjwmHsWi2WknF0Q== X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2559; 31:eGSJcLBQ6kh7rfgPwkYNKe8KCdKHNBxYuTdr4/+wW8TnGZwm/ZFiEmNrtTYMnKxKCaSxfp4My3a+wBLlhlRWsPwbqKff/Nb4k1q5ynoF8d6DZalP5N57bIkSl+iuq45AZtJ5Zxn2ikqj9RoolP9nCiR1uF80S5LkvOR0z2JCO2gp6+Fgi05+T4nce1KZeISyRJCCJP4J4GcuWv25JXtH18kON6v5TgFEUO1agLo6gEd6rQULMVOHu9vU9lx5NdZW; 20:cF08FY72kXNT4Vue/WBTMo3K2a8QupBsBtYqe2mLp3v09F1pAiXJU30mXkTWuqjqoR3P+wf100ZjC6adziPSVrwHL8paVXYdPJE0Mzk/qk05j3+jiq9XNcUcvN0uuQhQq4Dg/HykpZE/YRfG/Ovsj9VkMcG+DsJ5ozodJ9KXgNPzdZLOuzfCbjVtyy2PtzaprznVtQfCborsI+BcsHofrbZOqh2vav3xihsHqdtZIgnbuKJJMAF+B08KqGSn/xTInZ7cxLQY+TE72AAIVXnxUMPiOP5WizUlNrQNrgODm3h+tHgAYqDxRWp+OkbeV5FsINU7VGW8x4vEsQiiWRDzZJDqlWWbc4UvotZNJi64vs+7qTfrYrCtjI65wSNc3sdAc20XYJQGi+UOM+vlfTaPIr2pNInLo9Hf0UYxE6kXg14= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(20161123558025)(6072148); SRVR:VI1PR0802MB2559; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0802MB2559; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2559; 4:zVosfJ7VGKtpIlbKv5ogdyZ49c3qC5G2nePJ6oRwnoj9OYZTkr/ONFWHsBSg/FNet0AsQv1y3hQ0uTfzKHopX9c9h74AydHVk14g/WD6f15CUrC4qoeiURuIHoC2U6HlMNk65PDOF5jGkc3NcVEKweZNa4Kwect0OKYDoOYSQNroksoJ/w4CWa+dekehxZzLf5E3RdpSxOQJI/87vbhjI9GVZdg7wJohWOVNNnZjQJhoCH7sbnJGoNObfEuHXcu0pjuuwgnsl/1MfsYrNZEte1EBplu2UoCQsVQikzGxXThyoxDNS7q5azkuLKMCfg0ZHZmHOe48k/WfdLDLGnXjIwpE0DU+9fVtXXbOKxScBYJACEvlbVeRnmxuE2O10JMXM6LkF3VUEu+UST7zCA5Fahy76W4aLTeKRcOrCZn1giNtjqbbNf8hN9Y2N+L+4iFF+xipI72mgaj3Sfo3GPD1Nl/hLhUVQWjRvpjZRETjgkW4F02GMR/BJYL8QoRqREeTh7JCYhgxAAYEy9NOIr0YSiXIPjGo6P2S8YJBJV6zOgZSPlK+4RxQGPgzaxL9NELrzgImVthEkQcJkzYoBZQEuq6tcye8ZGsc5ElaCZMYjnrHGeGswfF4zM9x1TfUOlcaAHuPdJWZ++dHn/ZSmtHS/g== X-Forefront-PRVS: 02070414A1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(39450400003)(189002)(199003)(6116002)(48376002)(6486002)(2351001)(189998001)(68736007)(6506006)(38730400001)(50226002)(25786008)(54906002)(36756003)(53416004)(7736002)(106356001)(305945005)(8676002)(105586002)(101416001)(5003940100001)(53936002)(69596002)(42186005)(76176999)(50986999)(107886002)(81166006)(86362001)(2950100002)(4326007)(110136003)(81156014)(6666003)(2906002)(6916009)(5660300001)(33646002)(50466002)(92566002)(66066001)(97736004)(6512007)(1076002)(3846002)(4001430100002)(47776003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0802MB2559; H:pavelb-Z68P-DS3.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0802MB2559; 23:+C0741rqZakjE55LdHNqlmu4YUQSy6hcIwfIOY4?= =?us-ascii?Q?HrbFWfExbL7qqSav0u/Olh/dD0a8Mf9wcPUFpdHJWrL6ujXfeorzUg2abq8s?= =?us-ascii?Q?w4SRR1NgB5LSLl8ekhZZiZK2TYpHWyxy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X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2559; 7:N2d8HrmdbNwbx8+I7rg5ZosxvFRqAS1NUEfPISEo8VYBghNyT5eIZAv2bAr7XeHHdLVdpmzpBQUFuVihEGDYP/M/ZWc371+lVaoF4zRzJRfjCVB5FxGZOUPGkBXJk8Bso+tzbyNenk0rAowA4JgguR+LhDomwZDBSVHq/a95qPegDP+VyTlKS8fhyLyeTGcoBClQKX0Ao+Rvo3yZWqlSx7CglqFGOZE9JEdsA+rf6OfYNHXoFWaDmfGdwP/JnQR3BCaPZVUdKNneIevT4mpt8LpDr6RvYARjGs+SJk34jlRshlNsD/V4IAA6mAIubsoNuoOLhMYKtTUvycDX8yUUvufAOTYmt/ezFdir9+RGxM7Hkae+G9EenjQI5+93vp7Tk6FBE2/T1695aLOu9Vgk7/SQYPOChCdbVjrYtnzKammh9BvI4R0uj5Qf74nZ/pQs6cjpq28eyiHoKWxfHlU9fd/bWPTJz7B9C5n+lN020/BsvojQ51Qo+kBliCwMQI/Z9iiWD6NXl2Tee1G7p0ncIA==; 20:1rPCSpGduBBNgaq/VC6lnCXcohh3a3o8sf4ynEoTONFjUq/d1V9zElO16CbrQtkQXd6MIAeRKsDZK8crN8+D+s6P3PNW3LVwetd4OCoTZVBgwBeUp/dVSTz5Ba1CbNhbAUObfJ2/BPDp+n1qLfqmDKf+Ed7LJejtecF8WD1Qwp4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2017 15:23:38.4849 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2559 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.91 Subject: [Qemu-devel] [PATCH v2 1/3] migration: add MigrationState arg for ram_save_/compressed_/page() 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: pbutsykin@virtuozzo.com, quintela@redhat.com, armbru@redhat.com, amit.shah@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cosmetic patch. The use of ms variable instead of migrate_get_current() looks nicer, especially when there reuse. Signed-off-by: Pavel Butsykin Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daudé --- migration/ram.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index a683f4bb9e..d866b6518b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -734,13 +734,14 @@ static int save_zero_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset, * >=0 - Number of pages written - this might legally be 0 * if xbzrle noticed the page was the same. * + * @ms: The current migration state. * @f: QEMUFile where to send the data * @block: block that contains the page we want to send * @offset: offset inside the block for the page * @last_stage: if we are at the completion stage * @bytes_transferred: increase it with the number of transferred bytes */ -static int ram_save_page(QEMUFile *f, PageSearchStatus *pss, +static int ram_save_page(MigrationState *ms, QEMUFile *f, PageSearchStatus *pss, bool last_stage, uint64_t *bytes_transferred) { int pages = -1; @@ -786,8 +787,7 @@ static int ram_save_page(QEMUFile *f, PageSearchStatus *pss, */ xbzrle_cache_zero_page(current_addr); } else if (!ram_bulk_stage && - !migration_in_postcopy(migrate_get_current()) && - migrate_use_xbzrle()) { + !migration_in_postcopy(ms) && migrate_use_xbzrle()) { pages = save_xbzrle_page(f, &p, current_addr, block, offset, last_stage, bytes_transferred); if (!last_stage) { @@ -914,14 +914,15 @@ static int compress_page_with_multi_thread(QEMUFile *f, RAMBlock *block, * * Returns: Number of pages written. * + * @ms: The current migration state. * @f: QEMUFile where to send the data * @block: block that contains the page we want to send * @offset: offset inside the block for the page * @last_stage: if we are at the completion stage * @bytes_transferred: increase it with the number of transferred bytes */ -static int ram_save_compressed_page(QEMUFile *f, PageSearchStatus *pss, - bool last_stage, +static int ram_save_compressed_page(MigrationState *ms, QEMUFile *f, + PageSearchStatus *pss, bool last_stage, uint64_t *bytes_transferred) { int pages = -1; @@ -1252,11 +1253,11 @@ static int ram_save_target_page(MigrationState *ms, QEMUFile *f, if (migration_bitmap_clear_dirty(dirty_ram_abs)) { unsigned long *unsentmap; if (compression_switch && migrate_use_compression()) { - res = ram_save_compressed_page(f, pss, + res = ram_save_compressed_page(ms, f, pss, last_stage, bytes_transferred); } else { - res = ram_save_page(f, pss, last_stage, + res = ram_save_page(ms, f, pss, last_stage, bytes_transferred); }