From patchwork Tue Aug 21 08:10:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 10571179 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A226920 for ; Tue, 21 Aug 2018 08:11:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AA9E29DD0 for ; Tue, 21 Aug 2018 08:11:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1903329E0F; Tue, 21 Aug 2018 08:11:00 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC75029DDD for ; Tue, 21 Aug 2018 08:10:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726784AbeHULaF (ORCPT ); Tue, 21 Aug 2018 07:30:05 -0400 Received: from mail-pl0-f42.google.com ([209.85.160.42]:44684 "EHLO mail-pl0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726549AbeHULaF (ORCPT ); Tue, 21 Aug 2018 07:30:05 -0400 Received: by mail-pl0-f42.google.com with SMTP id ba4-v6so8427062plb.11 for ; Tue, 21 Aug 2018 01:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PgGybqDLCJbEJ+qjtJtsZofD+YTrV5tTXrhVisMfhNg=; b=F2UQT79N+Yd7B7oKuECGWfiPfLflRwBZCRfJDdfepVb9uF7qLmwY6sRc5wQPhkHOAP pybBNetOA8t9ve62FuoEQo6U2dvCYghGdeuBP4/Mp3WN4dnMcm2kgNf+uFUum8s/dq+g 6xa3m2MOT4K7bgsWblDs57+lFH2V2IJE7DhSMRDCgcLqGoKkN6XXwHlTwbtYVyJ6UMt+ SMxWEeSDXg9/97MDii9zMSv+48KGngcn54riDTRzZGIs7riSB4w7n2jtv+VWcTbELYc4 U3VztL4sDV9AbW0C+h9GOyY4i/j3O1F5dD3QRTmMAlB6kB/7ubhIUVPxNNqgo8ny8GVk rPXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PgGybqDLCJbEJ+qjtJtsZofD+YTrV5tTXrhVisMfhNg=; b=C+gKvmYFwSs8n+JVz7zjWnoLWukpBylfs34ZUaNCsWe2HrRgrCK4/CdTjuRR+hqqV8 55C+YiifZ0NmJQHCPMcogclMcfQlKSP3ieSpLV5JZvwuN/3pBP7geEsXMYxKTP/FxJEv Jpt+ejAh/411B/WiY1d2pk/MJ7pT1a9CIx1vBSF3xObZnNdESw23Hf7jxid3MhgRF5Wp PVFzvi1z+4fKh0cchtbea0ftmQ3VytpxQOfnp0/ynqdMpy5ZOcRMV3mcZyvPGlLrmEts Nat+LcQoEF/FKXQ0k6YmfTtRFafTQxfrf+/LJTgDSUV4GP+ceyQT4YVgSzuTZGcKLfg6 IwmA== X-Gm-Message-State: AOUpUlH/K6KqLTJYpVVjKUzzWsV+TXl3QUR8gcXlJN7QPejKz2QAyx1w uLeqMyDhHCu6IMEsnQElCZw= X-Google-Smtp-Source: AA+uWPzy/Qc/u+tbsalOjtYtB+ULJFz4vB5ym6zGshykZ2vWMcVphIll+QuvrkQJZlXByWFc1pGaSQ== X-Received: by 2002:a17:902:694a:: with SMTP id k10-v6mr48781416plt.166.1534839057333; Tue, 21 Aug 2018 01:10:57 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.40]) by smtp.gmail.com with ESMTPSA id r64-v6sm20644023pfk.157.2018.08.21.01.10.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Aug 2018 01:10:56 -0700 (PDT) From: guangrong.xiao@gmail.com X-Google-Original-From: xiaoguangrong@tencent.com To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, dgilbert@redhat.com, peterx@redhat.com, wei.w.wang@intel.com, jiang.biao2@zte.com.cn, eblake@redhat.com, Xiao Guangrong Subject: [PATCH v4 04/10] migration: drop the return value of do_compress_ram_page Date: Tue, 21 Aug 2018 16:10:23 +0800 Message-Id: <20180821081029.26121-5-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180821081029.26121-1-xiaoguangrong@tencent.com> References: <20180821081029.26121-1-xiaoguangrong@tencent.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Xiao Guangrong It is not used and cleans the code up a little Reviewed-by: Peter Xu Signed-off-by: Xiao Guangrong Reviewed-by: Juan Quintela --- migration/ram.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 49ace30614..e463de4f69 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -381,8 +381,8 @@ static QemuThread *decompress_threads; static QemuMutex decomp_done_lock; static QemuCond decomp_done_cond; -static int do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block, - ram_addr_t offset, uint8_t *source_buf); +static void do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block, + ram_addr_t offset, uint8_t *source_buf); static void *do_data_compress(void *opaque) { @@ -1842,15 +1842,14 @@ static int ram_save_multifd_page(RAMState *rs, RAMBlock *block, return 1; } -static int do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block, - ram_addr_t offset, uint8_t *source_buf) +static void do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block, + ram_addr_t offset, uint8_t *source_buf) { RAMState *rs = ram_state; - int bytes_sent, blen; uint8_t *p = block->host + (offset & TARGET_PAGE_MASK); + int ret; - bytes_sent = save_page_header(rs, f, block, offset | - RAM_SAVE_FLAG_COMPRESS_PAGE); + save_page_header(rs, f, block, offset | RAM_SAVE_FLAG_COMPRESS_PAGE); /* * copy it to a internal buffer to avoid it being modified by VM @@ -1858,17 +1857,14 @@ static int do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block, * decompression */ memcpy(source_buf, p, TARGET_PAGE_SIZE); - blen = qemu_put_compression_data(f, stream, source_buf, TARGET_PAGE_SIZE); - if (blen < 0) { - bytes_sent = 0; - qemu_file_set_error(migrate_get_current()->to_dst_file, blen); + ret = qemu_put_compression_data(f, stream, source_buf, TARGET_PAGE_SIZE); + if (ret < 0) { + qemu_file_set_error(migrate_get_current()->to_dst_file, ret); error_report("compressed data failed!"); - } else { - bytes_sent += blen; - ram_release_pages(block->idstr, offset & TARGET_PAGE_MASK, 1); + return; } - return bytes_sent; + ram_release_pages(block->idstr, offset & TARGET_PAGE_MASK, 1); } static void flush_compressed_data(RAMState *rs)