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: 10534249 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 D8A8B600F4 for ; Thu, 19 Jul 2018 12:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C837429463 for ; Thu, 19 Jul 2018 12:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC6A929539; Thu, 19 Jul 2018 12:16: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 51B0D29463 for ; Thu, 19 Jul 2018 12:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731526AbeGSM6v (ORCPT ); Thu, 19 Jul 2018 08:58:51 -0400 Received: from mail-pg1-f169.google.com ([209.85.215.169]:42781 "EHLO mail-pg1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731498AbeGSM6v (ORCPT ); Thu, 19 Jul 2018 08:58:51 -0400 Received: by mail-pg1-f169.google.com with SMTP id y4-v6so3583877pgp.9 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=j2TcA2kRFYQ16VrxP6mBrNsihSebEOIi6eV6RDGwjn3ft4Ds2aUPKY93NADP9pZ02N 2rVZrwfB1Hr5qUWya06mzli2AaDrilXZxrUpst9FJVgMYjC9jkpPxojzKVy+w45doPst FA90XeTW16z/4SuDrHoO1eJyf7cjbbDiNTsbRY21goRdAkpmTpvhJmxkjfjzUhb1xiP1 Hsqw8Wy7HtpztLNw+zQjQtSPMfar1BimgDRhraOR1SlpNY1HbO3xSf5EtF/5sgVNH865 GB+n3LYOsLtSlAhA7MBpEUXgPmXl+wuYIfFmmVgLZrVdZzPg9bTJAJgiTz+pcKi4wlx7 KAYw== X-Gm-Message-State: AOUpUlEY9MfYTvV9f5IvpyD8nHz2nRUb9w/z6nxlxc8rkXmUBNj52MKk cZrM1NvaNFe5K0G80WBGVw0= 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 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 v2 5/8] migration: drop the return value of do_compress_ram_page 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> 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 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)