[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 02/31] block: Make bdrv_round_to_cl
From: |
John Snow |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 02/31] block: Make bdrv_round_to_clusters() signature more useful |
Date: |
Wed, 26 Apr 2017 17:54:56 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
On 04/26/2017 05:47 PM, Eric Blake wrote:
> On 04/26/2017 04:41 PM, John Snow wrote:
>>
>>
>> On 04/17/2017 09:33 PM, 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 uint64_t, matching
>> ^^^^^^^^
>>
>> While we're here, since you went with int64_t in the end, what steered
>> you away from uint64_t, or was that just a thinko?
>
> Later patches were made easier with signed (the compiler complained when
> I mixed signed and unsigned pointers).
>
>>
>> (AFAICT: off_t is usually something like int64_t, so your choice makes
>> sense to me, generally.)
>
> Indeed, and that's something I should update my commit message to mention.
>
>>
>> --js
>>
>>> the signature already chosen for bdrv_is_allocated, and
>>> adjust clients according to the required fallout.
>
> If you want me to try and use uint64_t *pnum instead of int64_t *pnum
> throughout both my series 1 (the changes to bdrv_is_allocated) and this
> one, it will take more effort. I'll do it if there's a reason, but I'd
> rather not if the signed version is good enough.
>
No, I didn't mean to imply you should, I was just pointing out the
commit message typo. int64_t is likely the correct choice for a number
of reasons, at least being able to return -1 from functions returning a
byte offset being the chief reason.
--js
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH 00/31] make bdrv_get_block_status byte-based, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 03/31] qcow2: Switch is_zero_sectors() to byte-based, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 05/31] qemu-img: Switch get_block_status() to byte-based, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 06/31] block: Convert bdrv_get_block_status() to bytes, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 04/31] block: Switch bdrv_make_zero() to byte-based, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 07/31] block: Switch bdrv_co_get_block_status() to byte-based, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 08/31] block: Switch BdrvCoGetBlockStatusData to byte-based, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 09/31] block: Switch bdrv_co_get_block_status_above() to byte-based, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 10/31] block: Convert bdrv_get_block_status_above() to bytes, Eric Blake, 2017/04/17
- [Qemu-block] [PATCH 11/31] block: Add .bdrv_co_block_status() callback, Eric Blake, 2017/04/17