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: 10558419 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 AF59614E5 for ; Tue, 7 Aug 2018 09:12:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C29E26538 for ; Tue, 7 Aug 2018 09:12:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EE3627F3E; Tue, 7 Aug 2018 09:12:53 +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 3256626538 for ; Tue, 7 Aug 2018 09:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732760AbeHGL0O (ORCPT ); Tue, 7 Aug 2018 07:26:14 -0400 Received: from mail-pf1-f171.google.com ([209.85.210.171]:42248 "EHLO mail-pf1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727533AbeHGL0O (ORCPT ); Tue, 7 Aug 2018 07:26:14 -0400 Received: by mail-pf1-f171.google.com with SMTP id l9-v6so8267311pff.9 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=aXzQ0oVq6xB385kEUDHGSNP0/jMObmcDRaTOpBjsWr8OaFeSD7WYr73NMZpjKs4iQl SYNmqFYJsz09T0zrXNi+RPqCrd1r9U0qSd5a5BNXPxoB1896PQKcZjLiK18yGBa7Otqo S6Lq8JYzTsUn4kYJa8kQeS3b41JqLC9wlJxkfvQ4G++UQefj9A8i7OMJDMke9JGppg9d CbKUQsIIRaW/2shpjCv7VIR6dzkFbFVA5ETv/qMmx1i1mszCPw5gQ+vktHWHUTzLll9y 2RzU89tie+yc6gyWEGrmuVJzGSKcT4nxhqppLMaB78UtD2nXEtFwGtt0nZqJXttlumKt VxqA== X-Gm-Message-State: AOUpUlGZcmYisd8C7qQphnxUHO6CRbsPXPAxMighzCzPFwo7g3aVSZw+ kHWMOCLRJYMVlLXnWLHDlVw= 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 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 v3 04/10] migration: drop the return value of do_compress_ram_page 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> 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 --- 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)