From nobody Sun Oct 5 19:23:34 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 1519256874726981.4644468649376; Wed, 21 Feb 2018 15:47:54 -0800 (PST) Received: from localhost ([::1]:35323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoe75-0003bg-Qb for importer@patchew.org; Wed, 21 Feb 2018 18:47:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoe3N-0001qb-5R for qemu-devel@nongnu.org; Wed, 21 Feb 2018 18:45:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoe2J-0008Mf-4Q for qemu-devel@nongnu.org; Wed, 21 Feb 2018 18:44:01 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37392 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 1eodzb-0004aA-6I; Wed, 21 Feb 2018 18:40:07 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BB2640A0971; Wed, 21 Feb 2018 23:40:04 +0000 (UTC) Received: from red.redhat.com (ovpn-122-122.rdu2.redhat.com [10.10.122.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id E34CBAE7DC; Wed, 21 Feb 2018 23:40:02 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Wed, 21 Feb 2018 17:39:51 -0600 Message-Id: <20180221233953.5142-2-eblake@redhat.com> In-Reply-To: <20180221233953.5142-1-eblake@redhat.com> References: <20180221233953.5142-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 21 Feb 2018 23:40:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 21 Feb 2018 23:40:04 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@redhat.com' RCPT:'' 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] [PATCH v2 1/3] qcow2: Prefer byte-based calls into bs->file 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, berto@igalia.com, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We had only three sector-based stragglers left; convert them to use our preferred byte-based accesses. Signed-off-by: Eric Blake Reviewed-by: Alberto Garcia --- v2: indentation fix --- block/qcow2-cluster.c | 5 ++--- block/qcow2-refcount.c | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index e406b0f3b9e..85be7d5e340 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1615,13 +1615,12 @@ int qcow2_decompress_cluster(BlockDriverState *bs, = uint64_t cluster_offset) } BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED); - ret =3D bdrv_read(bs->file, coffset >> 9, s->cluster_data, - nb_csectors); + ret =3D bdrv_pread(bs->file, coffset, s->cluster_data, csize); if (ret < 0) { return ret; } if (decompress_buffer(s->cluster_cache, s->cluster_size, - s->cluster_data + sector_offset, csize) < 0)= { + s->cluster_data, csize) < 0) { return -EIO; } s->cluster_cache_offset =3D coffset; diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index d46b69d7f34..28afbb1b5ea 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -2310,8 +2310,8 @@ write_refblocks: on_disk_refblock =3D (void *)((char *) *refcount_table + refblock_index * s->cluster_size); - ret =3D bdrv_write(bs->file, refblock_offset / BDRV_SECTOR_SIZE, - on_disk_refblock, s->cluster_sectors); + ret =3D bdrv_pwrite(bs->file, refblock_offset, on_disk_refblock, + s->cluster_size); if (ret < 0) { fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-ret)= ); goto fail; @@ -2533,7 +2533,7 @@ fail: * - 0 if writing to this offset will not affect the mentioned metadata * - a positive QCow2MetadataOverlap value indicating one overlapping sect= ion * - a negative value (-errno) indicating an error while performing a chec= k, - * e.g. when bdrv_read failed on QCOW2_OL_INACTIVE_L2 + * e.g. when bdrv_pread failed on QCOW2_OL_INACTIVE_L2 */ int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t of= fset, int64_t size) --=20 2.14.3