From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: jsnow@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 4/5] qcow2: Use bytes instead of sectors for QCowL2Meta
Date: Fri, 3 Jun 2016 13:44:27 -0600 [thread overview]
Message-ID: <5751DE1B.6080403@redhat.com> (raw)
In-Reply-To: <1464974478-23598-5-git-send-email-kwolf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]
On 06/03/2016 11:21 AM, Kevin Wolf wrote:
> In preparation for implementing .bdrv_co_pwritev in qcow2.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/qcow2-cluster.c | 32 ++++++++++++--------------------
> block/qcow2.h | 13 +++----------
> 2 files changed, 15 insertions(+), 30 deletions(-)
>
> @@ -1192,25 +1191,20 @@ static int handle_alloc(BlockDriverState *bs, uint64_t guest_offset,
> /*
> * Save info needed for meta data update.
> *
> - * requested_sectors: Number of sectors from the start of the first
> + * requested_sectors: Number of bytes from the start of the first
This comment seems like an incomplete conversion. Is it sectors or bytes?
> - int requested_sectors =
> - (*bytes + offset_into_cluster(s, guest_offset))
> - >> BDRV_SECTOR_BITS;
> - int avail_sectors = nb_clusters
> - << (s->cluster_bits - BDRV_SECTOR_BITS);
> - int alloc_n_start = offset_into_cluster(s, guest_offset)
> - >> BDRV_SECTOR_BITS;
> - int nb_sectors = MIN(requested_sectors, avail_sectors);
> + int requested_bytes = *bytes + offset_into_cluster(s, guest_offset);
> + int avail_bytes = nb_clusters << s->cluster_bits;
Can this ever overflow?
Otherwise looks correct.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-06-03 19:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 17:21 [Qemu-devel] [PATCH 0/5] qcow2: Implement .bdrv_co_preadv/pwritev Kevin Wolf
2016-06-03 17:21 ` [Qemu-devel] [PATCH 1/5] qcow2: Work with bytes in qcow2_get_cluster_offset() Kevin Wolf
2016-06-03 17:44 ` Eric Blake
2016-06-03 17:21 ` [Qemu-devel] [PATCH 2/5] qcow2: Implement .bdrv_co_preadv() Kevin Wolf
2016-06-03 19:18 ` Eric Blake
2016-06-03 17:21 ` [Qemu-devel] [PATCH 3/5] qcow2: Make copy_sectors() byte based Kevin Wolf
2016-06-03 19:34 ` Eric Blake
2016-06-03 17:21 ` [Qemu-devel] [PATCH 4/5] qcow2: Use bytes instead of sectors for QCowL2Meta Kevin Wolf
2016-06-03 19:44 ` Eric Blake [this message]
2016-06-03 17:21 ` [Qemu-devel] [PATCH 5/5] qcow2: Implement .bdrv_co_pwritev Kevin Wolf
2016-06-03 20:13 ` Eric Blake
2016-06-06 14:50 ` Kevin Wolf
2016-06-03 22:59 ` 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=5751DE1B.6080403@redhat.com \
--to=eblake@redhat.com \
--cc=jsnow@redhat.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).