On 07/03/2017 10:10 AM, Eric Blake wrote: > Thanks to recent cleanups, most callers were scaling a return value > of sectors into bytes (the exception, in qcow2-bitmap, will be > converted to byte-based iteration later). Update the interface to > do the scaling internally instead. > > Signed-off-by: Eric Blake <ebl...@redhat.com>
> @@ -506,7 +506,7 @@ void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter) > > int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter) > { > - return hbitmap_iter_next(&iter->hbi); > + return hbitmap_iter_next(&iter->hbi) * BDRV_SECTOR_SIZE; > } > > +++ b/block/qcow2-bitmap.c > @@ -1105,7 +1105,7 @@ static uint64_t *store_bitmap_data(BlockDriverState *bs, > sbc = limit >> BDRV_SECTOR_BITS; > assert(DIV_ROUND_UP(bm_size, limit) == tb_size); > > - while ((sector = bdrv_dirty_iter_next(dbi)) != -1) { > + while ((sector = bdrv_dirty_iter_next(dbi) >> BDRV_SECTOR_BITS) != -1) { Does clang's sanitizer complain about right shift of a negative number, or is that one of the things that we can rely on even though C says it is not strictly portable? If it is a problem, I can always split the check for bdrv_dirty_iter_next()<0 to occur separately from the while() conditional; but I'd rather not go through with the churn unless it actually chokes a build-bot as written. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature