From patchwork Tue Aug 7 09:12:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 10558459 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 1033B1390 for ; Tue, 7 Aug 2018 09:19:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 010BA29B83 for ; Tue, 7 Aug 2018 09:19:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E91AB29B88; Tue, 7 Aug 2018 09:19:31 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 8FCBB29B83 for ; Tue, 7 Aug 2018 09:19:31 +0000 (UTC) Received: from localhost ([::1]:38047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmy9K-0000Gk-Q1 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 05:19:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmy2u-0003DG-Vg for qemu-devel@nongnu.org; Tue, 07 Aug 2018 05:12:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmy2t-00057V-U1 for qemu-devel@nongnu.org; Tue, 07 Aug 2018 05:12:52 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:41001) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmy2t-00057M-NW for qemu-devel@nongnu.org; Tue, 07 Aug 2018 05:12:51 -0400 Received: by mail-pf1-x42b.google.com with SMTP id y10-v6so8279000pfn.8 for ; Tue, 07 Aug 2018 02:12:51 -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=kGzKSUAUCol2lDdu6U4hQb9DlkJ9+vQ5XVRxZpO+4iZ/fGZoHUUhdJctVnNxOdEefc qvkECWQygJCVRalwCpx4qAWwRkE1lZNdrMcWZxBTwsQpEXmrI/l2cv7ICSjDEqBjcfd1 nV4gLDJXkLR4jGj9Bqcq0s11vdee5dsPgQptRfJCT3q5aImsGG+DS6CXW3MrFkONLBdT a8NLMwxu9JfEhVwIJYAlWfIbiRx6ElohOKmzAMHeA71HTzI1xKq4nxasZjhabCCAM4hM WxJHAZ0jG9PW6gySQ0v2QmoPXhGurJglS+vIa4zuT470V3CLU70BRFi+sXmjIeqoLcCx yqTQ== 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=OTvGTJzgL8VPqEb8SMB7RfTYWcFGLD+AnMM1M9s/hPFbYUlCkbCkcAhYeqxmL2MrKD T1aLqL21e3YY3Iu8cEoWVTTC5PZqZN3LnU++SyMc3FPLGZDJ2uj3Wt6ivUoS5MWXAoVj m+V5CQhXKxoU7OkhPC3b4kd+RjNYbdIzguHrvqI/zO4/ii4Xp2OCRpywz+0bauBymKs1 Uw5KqJvg5CDmzsjX7LPnlUCwsmiFV5Gg2II3srWPWGof3wE0e7dZJf9Xc72EukMRon4R uBjHxTTa2hbFnCszT/lp0FF1xhQc3q1QXQHvWHItkSNzILSGJnUEGNCSR3qkWk3p+RKV yqUg== X-Gm-Message-State: AOUpUlGb91EMgkPapaC2kXYvmjVknPCAQsS0qX1dLZTMh0rVnm3KJKvp 5mXzX+/H99aKVkBXCBsxmno= X-Google-Smtp-Source: AAOMgpe+My3pheKlqaW64cvs3NW4Vbtr9B6OYUrivCbaJ7mftJqfNCsJQCaPc8Jv25jDK81kauJRkA== X-Received: by 2002:a63:fb57:: with SMTP id w23-v6mr17942523pgj.441.1533633171030; Tue, 07 Aug 2018 02:12:51 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.37]) by smtp.gmail.com with ESMTPSA id z4-v6sm2159645pfl.11.2018.08.07.02.12.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 02:12:50 -0700 (PDT) From: guangrong.xiao@gmail.com X-Google-Original-From: xiaoguangrong@tencent.com To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com Date: Tue, 7 Aug 2018 17:12:03 +0800 Message-Id: <20180807091209.13531-5-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180807091209.13531-1-xiaoguangrong@tencent.com> References: <20180807091209.13531-1-xiaoguangrong@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42b Subject: [Qemu-devel] [PATCH v3 04/10] migration: drop the return value of do_compress_ram_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: kvm@vger.kernel.org, Xiao Guangrong , qemu-devel@nongnu.org, peterx@redhat.com, dgilbert@redhat.com, wei.w.wang@intel.com, jiang.biao2@zte.com.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- 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)