On 12/28/2017 08:55 PM, Fam Zheng wrote: > On Thu, 12/07 14:30, Eric Blake wrote: >> We are gradually moving away from sector-based interfaces, towards >> byte-based. Update the vpc driver accordingly. Drop the now-unused >> get_sector_offset(). > > No get_sector_offset change in the patch any more, it was removed by > 778b087e513ea6fdc525c5a194ff7c9b8d3f53cb.
Will tweak the commit message if I have reason to spin v7 (at least 9/20 had a real bug, which is probably easier for me to respin than to ask the maintainer to adjust). > >> >> Signed-off-by: Eric Blake <ebl...@redhat.com> >> >> --- >> - int64_t start, offset; >> + int64_t image_offset; >> bool allocated; >> - int64_t ret; >> + int ret; >> int n; >> >> do { >> /* All sectors in a block are contiguous (without using the bitmap) >> */ >> - n = ROUND_UP(sector_num + 1, s->block_size / BDRV_SECTOR_SIZE) >> - - sector_num; >> - n = MIN(n, nb_sectors); >> + n = ROUND_UP(offset + 1, s->block_size) - offset; >> + n = MIN(n, bytes); > > Should 'n' be updated to int64_t to match the types of offset and bytes? s->block_size is uint32_t, and a power of 2; therefore, rounding 'offset + 1' up to block size, then subtracting offset, can't exceed 32 bits. But that's tricky to audit for; I'm not opposed to changing the type of 'n' to 64-bits if you think that is easier to read. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature