From patchwork Thu Jul 19 12:15:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 10534265 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 7704A601D2 for ; Thu, 19 Jul 2018 12:22:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67C6626E74 for ; Thu, 19 Jul 2018 12:22:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B4AA27F60; Thu, 19 Jul 2018 12:22:02 +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 DA48926E74 for ; Thu, 19 Jul 2018 12:22:01 +0000 (UTC) Received: from localhost ([::1]:42100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg7wW-0006kR-Mj for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 Jul 2018 08:22:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg7qi-0002Cz-9e for qemu-devel@nongnu.org; Thu, 19 Jul 2018 08:16:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fg7qh-0005Th-7G for qemu-devel@nongnu.org; Thu, 19 Jul 2018 08:16:00 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:40342) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fg7qh-0005TE-0u for qemu-devel@nongnu.org; Thu, 19 Jul 2018 08:15:59 -0400 Received: by mail-pg1-x52e.google.com with SMTP id x5-v6so3581247pgp.7 for ; Thu, 19 Jul 2018 05:15:58 -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=O4pS8gEbytTb3R6OrpbGMegiK9SBuvi/9NY49ZO68JM=; b=FrMvyd7Q7U39M2UMpk1/Z9FnL+O3cXYT2o2RdDJm+iBuO/adoewJtRNafJtAosugma 8dRONdwV2zzWpr2Y9BjNMHd9JpaqCd4vsKaq/hE2Ud4q0RvWmoiK8n1sqpuUJgcE9Z9C 369gIBwfIvK/ybHuHWytUnF4IailT4D8y+lcimqXnfJQ7TAcV/DAqes4eBh5EPIDwWww tC553UE8k+EZy23L5n6QzCk+N0jINZpuEF5VpYtEefZ3rdzXYhIPBwVBSulOJgdeY8Id PwU2GxSv3ibob8plLeQpXakLY65dvpLSrfek8uJ/K2k7jXJ8AICKBTQY143kotf+UJK+ WFHw== 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=O4pS8gEbytTb3R6OrpbGMegiK9SBuvi/9NY49ZO68JM=; b=XVG+OQO4HN4rOODkzMWmqgAhW8mJwz+qY/NsAAg9yej4jglS1vscvyxVPBd04N3aMl 8D8IX1LeCnAH06uBhPgkB1xaQuuE512A0KaDsxd2C8Rtz1RQ6yBD23KTHe9rJbO3M+rF D88tR7yumq9o8LFWfsNU62PTMcuk7PEW9scCK7/bK9Pqz0nzl1OT/g7bdgqEZejkvVIJ GbuBl8M2ylo/cW948BbbSnhyyfdZxUmAtDlJSsBtimxmOBL055h1ZaF9hFmi84dxsomp SJ4/Hl4HfamU1NQ5vLM7AAoO3atAWLw60R9Y9JvJli5sCLz2WfSqjd8qBK60VNBwPH1B 3dqA== X-Gm-Message-State: AOUpUlHEPFdDt2mcQoNdlb58XRjUfXmiFt1sc29eNBWW8l7e37UOCQ/n tuiOqakZt20xpN6QjhGeLv5eDBdd X-Google-Smtp-Source: AAOMgpc6VOOU7c+cwupZ30jiyiXRDsQuG/g3rdB69VSLgHD/zzmILV5+EPYetm/S9aGt523YBCQq3Q== X-Received: by 2002:a63:ba10:: with SMTP id k16-v6mr9933305pgf.145.1532002558249; Thu, 19 Jul 2018 05:15:58 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.37]) by smtp.gmail.com with ESMTPSA id h190-v6sm21270456pge.85.2018.07.19.05.15.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jul 2018 05:15:57 -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: Thu, 19 Jul 2018 20:15:17 +0800 Message-Id: <20180719121520.30026-6-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180719121520.30026-1-xiaoguangrong@tencent.com> References: <20180719121520.30026-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::52e Subject: [Qemu-devel] [PATCH v2 5/8] 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 Signed-off-by: Xiao Guangrong Reviewed-by: Peter Xu --- migration/ram.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index ce6e69b649..5aa624b3b9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -392,8 +392,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) { @@ -1871,15 +1871,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 @@ -1887,17 +1886,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)