On 06/28/2017 07:05 AM, Vladimir Sementsov-Ogievskiy wrote: > Auto loading bitmaps are bitmaps in Qcow2, with the AUTO flag set. They > are loaded when the image is opened and become BdrvDirtyBitmaps for the > corresponding drive. > > Extra data in bitmaps is not supported for now. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > Reviewed-by: Max Reitz <[email protected]> > Reviewed-by: John Snow <[email protected]> > --- > block/qcow2-bitmap.c | 389 > +++++++++++++++++++++++++++++++++++++++++++++++++++ > block/qcow2.c | 17 ++- > block/qcow2.h | 2 + > 3 files changed, 406 insertions(+), 2 deletions(-)
> +
> +/* load_bitmap_data
> + * @bitmap_table entries must satisfy specification constraints.
> + * @bitmap must be cleared */
> +static int load_bitmap_data(BlockDriverState *bs,
> + const uint64_t *bitmap_table,
> + uint32_t bitmap_table_size,
> + BdrvDirtyBitmap *bitmap)
> +{
> + int ret = 0;
> + BDRVQcow2State *s = bs->opaque;
> + uint64_t sector, sbc;
> + uint64_t bm_size = bdrv_dirty_bitmap_size(bitmap);
Right now, this is returned as the size in sectors (my series changes it
to be the size in bytes, but that's being rebased on top of yours)
> + uint8_t *buf = NULL;
> + uint64_t i, tab_size =
> + size_to_clusters(s,
> + bdrv_dirty_bitmap_serialization_size(bitmap, 0, bm_size));
But bdrv_dirty_bitmap_serialization_size() takes count according to the
underlying hbitmap granularity. Hmm - you found a bug in my series -
when I convert dirty-bitmap.c to use byte-based counts everywhere, I
forgot to convert bdrv_dirty_bitmap_serialization_size(). Good thing
yours is going in first ;)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
