From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, berto@igalia.com,
qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH v6 1/6] qcow2: Prefer byte-based calls into bs->file
Date: Wed, 25 Apr 2018 21:51:24 -0500 [thread overview]
Message-ID: <20180426025129.621969-2-eblake@redhat.com> (raw)
In-Reply-To: <20180426025129.621969-1-eblake@redhat.com>
We had only a few sector-based stragglers left; convert them to use
our preferred byte-based accesses.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
---
v5: commit message tweak
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 1aee726c6a4..1dc00ff2110 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1616,13 +1616,12 @@ int qcow2_decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset)
}
BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED);
- ret = bdrv_read(bs->file, coffset >> 9, s->cluster_data,
- nb_csectors);
+ ret = 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 = coffset;
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 6b8b63514af..6bfc11bb48f 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -2359,8 +2359,8 @@ write_refblocks:
on_disk_refblock = (void *)((char *) *refcount_table +
refblock_index * s->cluster_size);
- ret = bdrv_write(bs->file, refblock_offset / BDRV_SECTOR_SIZE,
- on_disk_refblock, s->cluster_sectors);
+ ret = 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;
@@ -2582,7 +2582,7 @@ fail:
* - 0 if writing to this offset will not affect the mentioned metadata
* - a positive QCow2MetadataOverlap value indicating one overlapping section
* - a negative value (-errno) indicating an error while performing a check,
- * 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 offset,
int64_t size)
--
2.14.3
next prev parent reply other threads:[~2018-04-26 2:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 2:51 [Qemu-devel] [PATCH v6 0/6] minor qcow2 compression improvements Eric Blake
2018-04-26 2:51 ` Eric Blake [this message]
2018-04-26 2:51 ` [Qemu-devel] [PATCH v6 2/6] qcow2: Document some maximum size constraints Eric Blake
2018-04-26 2:51 ` [Qemu-devel] [PATCH v6 3/6] qcow2: Reduce REFT_OFFSET_MASK Eric Blake
2018-04-26 2:51 ` [Qemu-devel] [PATCH v6 4/6] qcow2: Don't allow overflow during cluster allocation Eric Blake
2018-04-26 2:51 ` [Qemu-devel] [PATCH v6 5/6] iotests: Add new test 214 for max compressed cluster offset Eric Blake
2018-04-26 12:10 ` Alberto Garcia
2018-06-19 18:51 ` Eric Blake
2018-06-20 12:10 ` Alberto Garcia
2018-04-26 2:51 ` [Qemu-devel] [PATCH v6 6/6] qcow2: Avoid memory over-allocation on compressed images Eric Blake
2018-06-19 18:49 ` [Qemu-devel] [PATCH v6 0/6] minor qcow2 compression improvements Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180426025129.621969-2-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).