From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6gkU-00088o-SE for qemu-devel@nongnu.org; Tue, 15 Nov 2016 11:38:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6gkT-0006LR-PX for qemu-devel@nongnu.org; Tue, 15 Nov 2016 11:38:18 -0500 References: <1478715476-132280-1-git-send-email-vsementsov@virtuozzo.com> <1478715476-132280-7-git-send-email-vsementsov@virtuozzo.com> From: John Snow Message-ID: <49dd68e9-1a4c-7dfd-3167-2be762e4a2f1@redhat.com> Date: Tue, 15 Nov 2016 11:38:07 -0500 MIME-Version: 1.0 In-Reply-To: <1478715476-132280-7-git-send-email-vsementsov@virtuozzo.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 06/21] block/dirty-bitmap: add deserialize_ones func List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, armbru@redhat.com, mreitz@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, den@openvz.org On 11/09/2016 01:17 PM, Vladimir Sementsov-Ogievskiy wrote: > Add bdrv_dirty_bitmap_deserialize_ones() function, which is needed for > qcow2 bitmap loading, to handle unallocated bitmap parts, marked as > all-ones. > > Reviewed-by: Kevin Wolf > Signed-off-by: Vladimir Sementsov-Ogievskiy It's odd to have the S-o-B below the R-B, but likely not truly important. Reviewed-by: John Snow > --- > block/dirty-bitmap.c | 7 +++++++ > include/block/dirty-bitmap.h | 3 +++ > include/qemu/hbitmap.h | 15 +++++++++++++++ > util/hbitmap.c | 17 +++++++++++++++++ > 4 files changed, 42 insertions(+) > > diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c > index 186941c..90af372 100644 > --- a/block/dirty-bitmap.c > +++ b/block/dirty-bitmap.c > @@ -499,6 +499,13 @@ void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirt= yBitmap *bitmap, > hbitmap_deserialize_zeroes(bitmap->bitmap, start, count, finish); > } > > +void bdrv_dirty_bitmap_deserialize_ones(BdrvDirtyBitmap *bitmap, > + uint64_t start, uint64_t count= , > + bool finish) > +{ > + hbitmap_deserialize_ones(bitmap->bitmap, start, count, finish); > +} > + > void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap) > { > hbitmap_deserialize_finish(bitmap->bitmap); > diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.= h > index 7cbe623..1e17729 100644 > --- a/include/block/dirty-bitmap.h > +++ b/include/block/dirty-bitmap.h > @@ -70,6 +70,9 @@ void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitm= ap *bitmap, > void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap, > uint64_t start, uint64_t cou= nt, > bool finish); > +void bdrv_dirty_bitmap_deserialize_ones(BdrvDirtyBitmap *bitmap, > + uint64_t start, uint64_t count= , > + bool finish); > void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap); > > #endif > diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h > index 594f6f8..5c9dd74 100644 > --- a/include/qemu/hbitmap.h > +++ b/include/qemu/hbitmap.h > @@ -216,6 +216,21 @@ void hbitmap_deserialize_zeroes(HBitmap *hb, uint6= 4_t start, uint64_t count, > bool finish); > > /** > + * hbitmap_deserialize_ones > + * @hb: HBitmap to operate on. > + * @start: First bit to restore. > + * @count: Number of bits to restore. > + * @finish: Whether to call hbitmap_deserialize_finish automatically. > + * > + * Fills the bitmap with ones. > + * > + * If @finish is false, caller must call hbitmap_serialize_finish befo= re using > + * the bitmap. > + */ > +void hbitmap_deserialize_ones(HBitmap *hb, uint64_t start, uint64_t co= unt, > + bool finish); > + > +/** > * hbitmap_deserialize_finish > * @hb: HBitmap to operate on. > * > diff --git a/util/hbitmap.c b/util/hbitmap.c > index 48d8b2d..72623f4 100644 > --- a/util/hbitmap.c > +++ b/util/hbitmap.c > @@ -531,6 +531,23 @@ void hbitmap_deserialize_zeroes(HBitmap *hb, uint6= 4_t start, uint64_t count, > } > } > > +void hbitmap_deserialize_ones(HBitmap *hb, uint64_t start, uint64_t co= unt, > + bool finish) > +{ > + uint64_t el_count; > + unsigned long *first; > + > + if (!count) { > + return; > + } > + serialization_chunk(hb, start, count, &first, &el_count); > + > + memset(first, 0xff, el_count * sizeof(unsigned long)); > + if (finish) { > + hbitmap_deserialize_finish(hb); > + } > +} > + > void hbitmap_deserialize_finish(HBitmap *bitmap) > { > int64_t i, size, prev_size; > --=20 =97js