[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 03/23] block: Make bdrv_round_to_clusters() s
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v4 03/23] block: Make bdrv_round_to_clusters() signature more useful |
Date: |
Fri, 29 Sep 2017 15:03:03 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/13/2017 11:03 AM, Eric Blake wrote:
> In the process of converting sector-based interfaces to bytes,
> I'm finding it easier to represent a byte count as a 64-bit
> integer at the block layer (even if we are internally capped
> by SIZE_MAX or even INT_MAX for individual transactions, it's
> still nicer to not have to worry about truncation/overflow
> issues on as many variables). Update the signature of
> bdrv_round_to_clusters() to uniformly use int64_t, matching
> the signature already chosen for bdrv_is_allocated and the
> fact that off_t is also a signed type, then adjust clients
> according to the required fallout.
>
> Signed-off-by: Eric Blake <address@hidden>
> Reviewed-by: Fam Zheng <address@hidden>
>
> @@ -946,7 +946,7 @@ static int coroutine_fn
> bdrv_co_do_copy_on_readv(BdrvChild *child,
> struct iovec iov;
> QEMUIOVector bounce_qiov;
> int64_t cluster_offset;
> - unsigned int cluster_bytes;
> + int64_t cluster_bytes;
> size_t skip_bytes;
> int ret;
Here, 'bytes' is still unsigned int, and I widened cluster_bytes,
> +++ b/block/trace-events
> @@ -12,7 +12,7 @@ blk_co_pwritev(void *blk, void *bs, int64_t offset,
> unsigned int bytes, int flag
> bdrv_co_preadv(void *bs, int64_t offset, int64_t nbytes, unsigned int flags)
> "bs %p offset %"PRId64" nbytes %"PRId64" flags 0x%x"
> bdrv_co_pwritev(void *bs, int64_t offset, int64_t nbytes, unsigned int
> flags) "bs %p offset %"PRId64" nbytes %"PRId64" flags 0x%x"
> bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) "bs %p
> offset %"PRId64" count %d flags 0x%x"
> -bdrv_co_do_copy_on_readv(void *bs, int64_t offset, unsigned int bytes,
> int64_t cluster_offset, unsigned int cluster_bytes) "bs %p offset %"PRId64"
> bytes %u cluster_offset %"PRId64" cluster_bytes %u"
> +bdrv_co_do_copy_on_readv(void *bs, int64_t offset, int64_t bytes, int64_t
> cluster_offset, unsigned int cluster_bytes) "bs %p offset %"PRId64" bytes
> %"PRId64" cluster_offset %"PRId64" cluster_bytes %u"
but I botched which variable got widened in the trace.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v4 02/23] block: Add flag to avoid wasted work in bdrv_is_allocated(), (continued)
- Re: [Qemu-devel] [PATCH v4 03/23] block: Make bdrv_round_to_clusters() signature more useful,
Eric Blake <=
[Qemu-devel] [PATCH v4 05/23] block: Switch bdrv_make_zero() to byte-based, Eric Blake, 2017/09/13
[Qemu-devel] [PATCH v4 04/23] qcow2: Switch is_zero_sectors() to byte-based, Eric Blake, 2017/09/13
[Qemu-devel] [PATCH v4 06/23] qemu-img: Switch get_block_status() to byte-based, Eric Blake, 2017/09/13
[Qemu-devel] [PATCH v4 07/23] block: Convert bdrv_get_block_status() to bytes, Eric Blake, 2017/09/13
[Qemu-devel] [PATCH v4 08/23] block: Switch bdrv_co_get_block_status() to byte-based, Eric Blake, 2017/09/13