From nobody Tue Feb 10 11:55:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683200420; cv=none; d=zohomail.com; s=zohoarc; b=oHcnP/k1Dy9bhfGJ/S9yeiuVTO3LzS5DUaJw8qSppIMvs0M1V5RJD5JeeZJcwb03oMyDy9XJYLQq5oQDtgnqDgnXzvMe5HFA3qUJOKIZfXtyp/OVSZEYTuNH3hMAbOoRVGccdaP79BPKprC9/pOzQhhjWMZaP/b2Vg8bTvTQTtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200420; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I7bnCvHPplp/VOFkHO6aBDrYgud8J2hfG1mFqO+Qfi8=; b=UFtibuUypyOid571aYtQ8Lct7+DwEw7lj6d0SvSzVifeEVkwemSF3CS69sK78CD65zhz6fLL0kQkJkrIq+8SbimnCu81lNq8jl837cbLDpxLk4Zs4+RrU5X2y2R7zgYxC59zlZGCxLggMaRmidfqu3/HecIt755u5kgcNAiwJmM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683200420738803.8141795206843; Thu, 4 May 2023 04:40:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXId-00063G-Dn; Thu, 04 May 2023 07:39:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIa-00061h-Ua for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIY-0003Ly-Lh for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-251-JAdnwe9CPa-1NYSsYDMmfg-1; Thu, 04 May 2023 07:38:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 99B0A85A5A3; Thu, 4 May 2023 11:38:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 696BB2166B30; Thu, 4 May 2023 11:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I7bnCvHPplp/VOFkHO6aBDrYgud8J2hfG1mFqO+Qfi8=; b=FrbbfUQhvkbkxmts4T9p3u4ilwi2oIbjmGtzrSY3ij5V0asiWFMYk1zXmc06uTlYuOpwAY MsHIuiG5nLrdthkAXVPU62/zc20EDBIWeJGjvGXz3Ut/JeJomC4SBkrV9QHKqk+0/HwsBC XNHAZa24EQrwJv+3itlDlffbv0+PjlQ= X-MC-Unique: JAdnwe9CPa-1NYSsYDMmfg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 7/9] qemu-file: Make total_transferred an uint64_t Date: Thu, 4 May 2023 13:38:39 +0200 Message-Id: <20230504113841.23130-8-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200421359100003 Content-Type: text/plain; charset="utf-8" Change all the functions that use it. It was already passed as uint64_t. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 --- migration/block.c | 5 ++--- migration/qemu-file.c | 8 ++++---- migration/qemu-file.h | 4 ++-- migration/savevm.c | 6 ++---- migration/vmstate.c | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/migration/block.c b/migration/block.c index 3499f75e37..a37678ce95 100644 --- a/migration/block.c +++ b/migration/block.c @@ -747,8 +747,7 @@ static int block_save_setup(QEMUFile *f, void *opaque) static int block_save_iterate(QEMUFile *f, void *opaque) { int ret; - int64_t last_bytes =3D qemu_file_total_transferred(f); - int64_t delta_bytes; + uint64_t last_bytes =3D qemu_file_total_transferred(f); =20 trace_migration_block_save("iterate", block_mig_state.submitted, block_mig_state.transferred); @@ -800,7 +799,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) } =20 qemu_put_be64(f, BLK_MIG_FLAG_EOS); - delta_bytes =3D qemu_file_total_transferred(f) - last_bytes; + uint64_t delta_bytes =3D qemu_file_total_transferred(f) - last_bytes; return (delta_bytes > 0); } =20 diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 7b32ef45a9..e97d180f17 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -51,7 +51,7 @@ struct QEMUFile { uint64_t rate_limit_used; =20 /* The sum of bytes transferred on the wire */ - int64_t total_transferred; + uint64_t total_transferred; =20 int buf_index; int buf_size; /* 0 when writing */ @@ -718,9 +718,9 @@ int coroutine_mixed_fn qemu_get_byte(QEMUFile *f) return result; } =20 -int64_t qemu_file_total_transferred_fast(QEMUFile *f) +uint64_t qemu_file_total_transferred_fast(QEMUFile *f) { - int64_t ret =3D f->total_transferred; + uint64_t ret =3D f->total_transferred; int i; =20 for (i =3D 0; i < f->iovcnt; i++) { @@ -730,7 +730,7 @@ int64_t qemu_file_total_transferred_fast(QEMUFile *f) return ret; } =20 -int64_t qemu_file_total_transferred(QEMUFile *f) +uint64_t qemu_file_total_transferred(QEMUFile *f) { qemu_fflush(f); return f->total_transferred; diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 55ef5a2ac7..d758e7f10b 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -83,7 +83,7 @@ int qemu_fclose(QEMUFile *f); * * Returns: the total bytes transferred */ -int64_t qemu_file_total_transferred(QEMUFile *f); +uint64_t qemu_file_total_transferred(QEMUFile *f); =20 /* * qemu_file_total_transferred_fast: @@ -95,7 +95,7 @@ int64_t qemu_file_total_transferred(QEMUFile *f); * * Returns: the total bytes transferred and queued */ -int64_t qemu_file_total_transferred_fast(QEMUFile *f); +uint64_t qemu_file_total_transferred_fast(QEMUFile *f); =20 /* * put_buffer without copying the buffer. diff --git a/migration/savevm.c b/migration/savevm.c index a9d0a88e62..032044b1d5 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -927,11 +927,9 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *s= e) static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) { - int64_t old_offset, size; - - old_offset =3D qemu_file_total_transferred_fast(f); + uint64_t old_offset =3D qemu_file_total_transferred_fast(f); se->ops->save_state(f, se->opaque); - size =3D qemu_file_total_transferred_fast(f) - old_offset; + uint64_t size =3D qemu_file_total_transferred_fast(f) - old_offset; =20 if (vmdesc) { json_writer_int64(vmdesc, "size", size); diff --git a/migration/vmstate.c b/migration/vmstate.c index 83ca4c7d3e..351f56104e 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -349,7 +349,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, void *first_elem =3D opaque + field->offset; int i, n_elems =3D vmstate_n_elems(opaque, field); int size =3D vmstate_size(opaque, field); - int64_t old_offset, written_bytes; + uint64_t old_offset, written_bytes; JSONWriter *vmdesc_loop =3D vmdesc; =20 trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems= ); --=20 2.40.0