From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: berto@igalia.com, qemu-block@nongnu.org, kwolf@redhat.com,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v4 1/5] qcow2: Prefer byte-based calls into bs->file
Date: Tue, 27 Feb 2018 10:29:40 -0600 [thread overview]
Message-ID: <20180227162944.17343-1-eblake@redhat.com> (raw)
In-Reply-To: <20180227155514.16721-1-eblake@redhat.com>
We had only three 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>
---
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 = 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 d46b69d7f34..28afbb1b5ea 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -2310,8 +2310,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;
@@ -2533,7 +2533,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-02-27 16:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 15:55 [Qemu-devel] [PATCH v4 0/5] minor compression improvements Eric Blake
2018-02-27 16:29 ` Eric Blake [this message]
2018-02-27 16:29 ` [Qemu-devel] [PATCH v4 2/5] qcow2: Document some maximum size constraints Eric Blake
2018-02-28 10:26 ` Alberto Garcia
2018-02-28 14:01 ` Eric Blake
2018-02-28 14:20 ` Alberto Garcia
2018-04-13 17:08 ` Max Reitz
2018-04-18 13:49 ` Eric Blake
2018-02-27 16:29 ` [Qemu-devel] [PATCH v4 3/5] qcow2: Reduce REFT_OFFSET_MASK Eric Blake
2018-02-28 12:18 ` Alberto Garcia
2018-02-27 16:29 ` [Qemu-devel] [PATCH v4 4/5] qcow2: Don't allow overflow during cluster allocation Eric Blake
2018-02-27 16:29 ` [Qemu-devel] [PATCH v4 5/5] qcow2: Avoid memory over-allocation on compressed images Eric Blake
2018-02-28 14:22 ` Alberto Garcia
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=20180227162944.17343-1-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).