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: 946239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FrMvyd7Q"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41WY5v2Qnmz9s0n for ; Thu, 19 Jul 2018 22:21:23 +1000 (AEST) Received: from localhost ([::1]:42091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg7vt-0005v7-1O for incoming@patchwork.ozlabs.org; Thu, 19 Jul 2018 08:21:21 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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)