[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v4 09/17] dirty-bitmap: Change bdrv
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH v4 09/17] dirty-bitmap: Change bdrv_dirty_iter_next() to report byte offset |
Date: |
Tue, 11 Jul 2017 11:50:08 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
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 <address@hidden>
> @@ -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
- [Qemu-block] [PATCH v4 05/17] dirty-bitmap: Change bdrv_dirty_bitmap_size() to report bytes, (continued)
- [Qemu-block] [PATCH v4 07/17] qcow2: Switch sectors_covered_by_bitmap_cluster() to byte-based, Eric Blake, 2017/07/03
- [Qemu-block] [PATCH v4 08/17] dirty-bitmap: Set iterator start by offset, not sector, Eric Blake, 2017/07/03
- [Qemu-block] [PATCH v4 09/17] dirty-bitmap: Change bdrv_dirty_iter_next() to report byte offset, Eric Blake, 2017/07/03
- [Qemu-block] [PATCH v4 11/17] dirty-bitmap: Change bdrv_get_dirty_locked() to take bytes, Eric Blake, 2017/07/03
- [Qemu-block] [PATCH v4 10/17] dirty-bitmap: Change bdrv_get_dirty_count() to report bytes, Eric Blake, 2017/07/03
- [Qemu-block] [PATCH v4 12/17] dirty-bitmap: Change bdrv_[re]set_dirty_bitmap() to use bytes, Eric Blake, 2017/07/03
- [Qemu-block] [PATCH v4 13/17] mirror: Switch mirror_dirty_init() to byte-based iteration, Eric Blake, 2017/07/03
- [Qemu-block] [PATCH v4 15/17] qcow2: Switch store_bitmap_data() to byte-based iteration, Eric Blake, 2017/07/03
- [Qemu-block] [PATCH v4 14/17] qcow2: Switch load_bitmap_data() to byte-based iteration, Eric Blake, 2017/07/03