[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/5] qcow2: Use bytes instead of sectors for QCo
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 4/5] qcow2: Use bytes instead of sectors for QCowL2Meta |
Date: |
Fri, 3 Jun 2016 13:44:27 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 06/03/2016 11:21 AM, Kevin Wolf wrote:
> In preparation for implementing .bdrv_co_pwritev in qcow2.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> 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
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 0/5] qcow2: Implement .bdrv_co_preadv/pwritev, Kevin Wolf, 2016/06/03
- [Qemu-devel] [PATCH 1/5] qcow2: Work with bytes in qcow2_get_cluster_offset(), Kevin Wolf, 2016/06/03
- [Qemu-devel] [PATCH 4/5] qcow2: Use bytes instead of sectors for QCowL2Meta, Kevin Wolf, 2016/06/03
- Re: [Qemu-devel] [PATCH 4/5] qcow2: Use bytes instead of sectors for QCowL2Meta,
Eric Blake <=
- [Qemu-devel] [PATCH 3/5] qcow2: Make copy_sectors() byte based, Kevin Wolf, 2016/06/03
- [Qemu-devel] [PATCH 2/5] qcow2: Implement .bdrv_co_preadv(), Kevin Wolf, 2016/06/03
- [Qemu-devel] [PATCH 5/5] qcow2: Implement .bdrv_co_pwritev, Kevin Wolf, 2016/06/03