On 10/02/2017 09:39 AM, Vladimir Sementsov-Ogievskiy wrote: > The function searches for next zero bit. > Also add interface for BdrvDirtyBitmap. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > --- > include/block/dirty-bitmap.h | 1 + > include/qemu/hbitmap.h | 8 ++++++++ > block/dirty-bitmap.c | 5 +++++ > util/hbitmap.c | 29 +++++++++++++++++++++++++++++ > 4 files changed, 43 insertions(+) >
> +++ b/block/dirty-bitmap.c
> @@ -715,3 +715,8 @@ char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap
> *bitmap, Error **errp)
> {
> return hbitmap_sha256(bitmap->bitmap, errp);
> }
> +
> +int64_t bdrv_dirty_bitmap_next_zero(BdrvDirtyBitmap *bitmap, uint64_t offset)
> +{
> + return hbitmap_next_zero(bitmap->bitmap, offset);
> +}
Returns an answer in the same scale as the underlying hbitmap; if this
is applied before my byte-based dirty bitmap series, that means offset
is a sector count and the result is likewise a sector number (awkward);
if this is applied after my series, you pass in a byte offset start and
get a byte result (nice).
I don't see any obvious errors in the implementation, but DO think that
you should include a testsuite enhancement in tests/test-hbitmap.c to
cover the new functionality before we accept this.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
