From nobody Sun Nov 2 17:38:50 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528086454643288.7374923115084; Sun, 3 Jun 2018 21:27:34 -0700 (PDT) Received: from localhost ([::1]:37583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPh5h-0007tD-Oh for importer@patchew.org; Mon, 04 Jun 2018 00:27:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPh0Y-0004Rb-9v for qemu-devel@nongnu.org; Mon, 04 Jun 2018 00:22:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPh0X-00077c-9s for qemu-devel@nongnu.org; Mon, 04 Jun 2018 00:22:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50932 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fPh0X-00077E-5r for qemu-devel@nongnu.org; Mon, 04 Jun 2018 00:22:13 -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 mx1.redhat.com (Postfix) with ESMTPS id C61A3401EF05; Mon, 4 Jun 2018 04:22:12 +0000 (UTC) Received: from secure.mitica (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 768BD2166BB2; Mon, 4 Jun 2018 04:22:11 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 4 Jun 2018 06:21:55 +0200 Message-Id: <20180604042156.13812-5-quintela@redhat.com> In-Reply-To: <20180604042156.13812-1-quintela@redhat.com> References: <20180604042156.13812-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 04 Jun 2018 04:22:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 04 Jun 2018 04:22:12 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 4/5] migration: remove unnecessary variables len in QIOChannelRDMA 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: lvivier@redhat.com, Lidong Chen , dgilbert@redhat.com, peterx@redhat.com, Lidong Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Lidong Chen Because qio_channel_rdma_writev and qio_channel_rdma_readv maybe invoked by different threads concurrently, this patch removes unnecessary variables len in QIOChannelRDMA and use local variable instead. Signed-off-by: Lidong Chen Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela Signed-off-by: Lidong Chen --- migration/rdma.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 7d233b0820..60779221b1 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -400,7 +400,6 @@ struct QIOChannelRDMA { QIOChannel parent; RDMAContext *rdma; QEMUFile *file; - size_t len; bool blocking; /* XXX we don't actually honour this yet */ }; =20 @@ -2608,6 +2607,7 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *io= c, int ret; ssize_t done =3D 0; size_t i; + size_t len =3D 0; =20 CHECK_ERROR_STATE(); =20 @@ -2627,10 +2627,10 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *= ioc, while (remaining) { RDMAControlHeader head; =20 - rioc->len =3D MIN(remaining, RDMA_SEND_INCREMENT); - remaining -=3D rioc->len; + len =3D MIN(remaining, RDMA_SEND_INCREMENT); + remaining -=3D len; =20 - head.len =3D rioc->len; + head.len =3D len; head.type =3D RDMA_CONTROL_QEMU_FILE; =20 ret =3D qemu_rdma_exchange_send(rdma, &head, data, NULL, NULL,= NULL); @@ -2640,8 +2640,8 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *io= c, return ret; } =20 - data +=3D rioc->len; - done +=3D rioc->len; + data +=3D len; + done +=3D len; } } =20 @@ -2736,8 +2736,7 @@ static ssize_t qio_channel_rdma_readv(QIOChannel *ioc, } } } - rioc->len =3D done; - return rioc->len; + return done; } =20 /* --=20 2.17.0