From nobody Thu Jul 10 04:30:54 2025 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1653392019; cv=none; d=zohomail.com; s=zohoarc; b=JkrktOYTTYa4b7yOj4hTfOuS4qf8C//7aXmHSlD1aXsXpUMsRIb0HDVGiSPlLiS5mfSjO2JBobxLMHN4YYv0awI8Sm3UOv+mPU3cgvLpeQpY9K9wjo1D5BiB98vibCPLuSw5iqK8NhAIzAFauRPYXEZcceMYryuggpl6C5Kp4Qc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653392019; h=Content-Type: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=RXEWyGS/rz1gatyWIzQy/8Z/ugpqfdru8mXrKQt1Zr0=; b=oJnpFrg3F3l+gF2LWYq0AkAx+qxwb5K2Et6BSMDECdgoOFiNm0mo9RqMNI4YXVRC6UUubd3p0SHc6dPSwdrTFiyb+fhKOQu7isZtxNTdtMzMU4EJ9oVvYt+wAbOOSoiPX/WNmxOxYDD8MHVDYYx7XJFuq+5HEw5YNTNZdoxrKf8= 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+importer2=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 1653392019357714.241207151496; Tue, 24 May 2022 04:33:39 -0700 (PDT) Received: from localhost ([::1]:36190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntSnA-0003z7-W3 for importer2@patchew.org; Tue, 24 May 2022 07:33:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntSJV-0005mG-2a for qemu-devel@nongnu.org; Tue, 24 May 2022 07:02:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntSJP-0003Nb-7N for qemu-devel@nongnu.org; Tue, 24 May 2022 07:02:56 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-115-skjQYr1wNo-onKL-17Qrjw-1; Tue, 24 May 2022 07:02:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8BBFB3C025B0; Tue, 24 May 2022 11:02:47 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27C8C1121315; Tue, 24 May 2022 11:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653390169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RXEWyGS/rz1gatyWIzQy/8Z/ugpqfdru8mXrKQt1Zr0=; b=RTgoYdHSkD4Zg17FgJqEX3vIYojUj1I2JAMfAONjwutVZOIz7XfRe3Hme2hJaRGqcOJ2Jb vPy+OEHD4AJ7F8ra0CnUoK7mqMGVNySyziIwgjSKYObdVJtDitRp5JBeQ80h/39HeAUCXI QPXEwnHoU4jmfHAYrfqKgP4B+uJKIZk= X-MC-Unique: skjQYr1wNo-onKL-17Qrjw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , "Dr. David Alan Gilbert" , qemu-block@nongnu.org, Stefan Hajnoczi , Hailiang Zhang , Juan Quintela , Fam Zheng Subject: [PATCH 05/20] migration: rename 'pos' field in QEMUFile to 'bytes_processed' Date: Tue, 24 May 2022 12:02:20 +0100 Message-Id: <20220524110235.145079-6-berrange@redhat.com> In-Reply-To: <20220524110235.145079-1-berrange@redhat.com> References: <20220524110235.145079-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1653392021285100001 This makes the field name align with the newly introduced method names in the previous commit. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- migration/qemu-file.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 03f0b13a55..b21da4c5bf 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -50,8 +50,9 @@ struct QEMUFile { */ int64_t rate_limit_used; =20 - int64_t pos; /* start of buffer when writing, end of buffer - when reading */ + /* The sum of bytes transferred on the wire */ + int64_t total_transferred; + int buf_index; int buf_size; /* 0 when writing */ uint8_t buf[IO_BUF_SIZE]; @@ -241,14 +242,14 @@ void qemu_fflush(QEMUFile *f) } if (f->iovcnt > 0) { expect =3D iov_size(f->iov, f->iovcnt); - ret =3D f->ops->writev_buffer(f->opaque, f->iov, f->iovcnt, f->pos, + ret =3D f->ops->writev_buffer(f->opaque, f->iov, f->iovcnt, f->tot= al_transferred, &local_error); =20 qemu_iovec_release_ram(f); } =20 if (ret >=3D 0) { - f->pos +=3D ret; + f->total_transferred +=3D ret; } /* We expect the QEMUFile write impl to send the full * data set we requested, so sanity check that. @@ -357,11 +358,11 @@ static ssize_t qemu_fill_buffer(QEMUFile *f) return 0; } =20 - len =3D f->ops->get_buffer(f->opaque, f->buf + pending, f->pos, + len =3D f->ops->get_buffer(f->opaque, f->buf + pending, f->total_trans= ferred, IO_BUF_SIZE - pending, &local_error); if (len > 0) { f->buf_size +=3D len; - f->pos +=3D len; + f->total_transferred +=3D len; } else if (len =3D=3D 0) { qemu_file_set_error_obj(f, -EIO, local_error); } else if (len !=3D -EAGAIN) { @@ -375,7 +376,7 @@ static ssize_t qemu_fill_buffer(QEMUFile *f) =20 void qemu_update_position(QEMUFile *f, size_t size) { - f->pos +=3D size; + f->total_transferred +=3D size; } =20 /** Closes the file @@ -658,7 +659,7 @@ int qemu_get_byte(QEMUFile *f) =20 int64_t qemu_ftell_fast(QEMUFile *f) { - int64_t ret =3D f->pos; + int64_t ret =3D f->total_transferred; int i; =20 for (i =3D 0; i < f->iovcnt; i++) { @@ -671,7 +672,7 @@ int64_t qemu_ftell_fast(QEMUFile *f) int64_t qemu_ftell(QEMUFile *f) { qemu_fflush(f); - return f->pos; + return f->total_transferred; } =20 int qemu_file_rate_limit(QEMUFile *f) --=20 2.36.1