From nobody Fri Nov 7 00:59:15 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=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544547112901257.4007158730194; Tue, 11 Dec 2018 08:51:52 -0800 (PST) Received: from localhost ([::1]:40075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gWlGB-0001R7-IY for importer@patchew.org; Tue, 11 Dec 2018 11:51:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gWl85-0001u5-CI for qemu-devel@nongnu.org; Tue, 11 Dec 2018 11:43:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gWl84-0004KK-Bt for qemu-devel@nongnu.org; Tue, 11 Dec 2018 11:43:29 -0500 Received: from relay.sw.ru ([185.231.240.75]:47268) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gWl82-0004DO-79; Tue, 11 Dec 2018 11:43:28 -0500 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gWl7v-0001lo-SY; Tue, 11 Dec 2018 19:43:19 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 11 Dec 2018 19:43:15 +0300 Message-Id: <20181211164317.32893-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181211164317.32893-1-vsementsov@virtuozzo.com> References: <20181211164317.32893-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH v2 6/8] qcow2: qcow2_co_preadv: skip using hd_qiov when possible 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: kwolf@redhat.com, vsementsov@virtuozzo.com, berto@igalia.com, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" qemu_iovec_memset has @offset parameter, so using hd_qiov for it is not needed. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/qcow2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 2a49314e42..4e217ee918 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1888,18 +1888,13 @@ static coroutine_fn int qcow2_co_preadv(BlockDriver= State *bs, uint64_t offset, goto fail; } =20 - offset_in_cluster =3D offset_into_cluster(s, offset); - - qemu_iovec_reset(&hd_qiov); - qemu_iovec_concat(&hd_qiov, qiov, bytes_done, cur_bytes); - if (ret =3D=3D QCOW2_CLUSTER_ZERO_PLAIN || ret =3D=3D QCOW2_CLUSTER_ZERO_ALLOC || (ret =3D=3D QCOW2_CLUSTER_UNALLOCATED && !bs->backing)) { /* No sense in releasing the lock */ =20 - qemu_iovec_memset(&hd_qiov, 0, 0, cur_bytes); + qemu_iovec_memset(qiov, bytes_done, 0, cur_bytes); =20 bytes -=3D cur_bytes; offset +=3D cur_bytes; @@ -1907,6 +1902,11 @@ static coroutine_fn int qcow2_co_preadv(BlockDriverS= tate *bs, uint64_t offset, continue; } =20 + offset_in_cluster =3D offset_into_cluster(s, offset); + + qemu_iovec_reset(&hd_qiov); + qemu_iovec_concat(&hd_qiov, qiov, bytes_done, cur_bytes); + qemu_co_mutex_unlock(&s->lock); =20 switch (ret) { --=20 2.18.0