qemu-devel
[Top][All Lists]
Advanced

[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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]