Received: from eggs.gnu.org ([2001:4830:134:3::10]:40566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNH7Y-0005VI-Br for qemu-devel@nongnu.org; Wed, 13 Jul 2016 06:10:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNH7X-0006Y4-4w for qemu-devel@nongnu.org; Wed, 13 Jul 2016 06:10:24 -0400 References: <1464928382-9650-1-git-send-email-famz@redhat.com> <1464928382-9650-2-git-send-email-famz@redhat.com> <5785F46E.20909@virtuozzo.com> From: Max Reitz Message-ID: <57ebebd9-79e1-5cb9-05bc-bb9d8f4e9ad8@redhat.com> Date: Wed, 13 Jul 2016 12:10:13 +0200 MIME-Version: 1.0 In-Reply-To: <5785F46E.20909@virtuozzo.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BrVXbrN1rqlkDIoSTpoVPldd9Gc2KJgaT" Subject: Re: [Qemu-devel] [PATCH v5 01/10] block: Hide HBitmap in block dirty bitmap interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , John Snow , Fam Zheng , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BrVXbrN1rqlkDIoSTpoVPldd9Gc2KJgaT From: Max Reitz To: Vladimir Sementsov-Ogievskiy , John Snow , Fam Zheng , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org Message-ID: <57ebebd9-79e1-5cb9-05bc-bb9d8f4e9ad8@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 01/10] block: Hide HBitmap in block dirty bitmap interface References: <1464928382-9650-1-git-send-email-famz@redhat.com> <1464928382-9650-2-git-send-email-famz@redhat.com> <5785F46E.20909@virtuozzo.com> In-Reply-To: <5785F46E.20909@virtuozzo.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 13.07.2016 09:57, Vladimir Sementsov-Ogievskiy wrote: > On 13.07.2016 01:49, John Snow wrote: >> >> On 06/03/2016 12:32 AM, Fam Zheng wrote: >>> HBitmap is an implementation detail of block dirty bitmap that should= >>> be hidden >>> from users. Introduce a BdrvDirtyBitmapIter to encapsulate the >>> underlying >>> HBitmapIter. >>> >>> A small difference in the interface is, before, an HBitmapIter is >>> initialized >>> in place, now the new BdrvDirtyBitmapIter must be dynamically >>> allocated because >>> the structure definition is in block/dirty-bitmap.c. >>> >>> Two current users are converted too. >>> >>> Signed-off-by: Fam Zheng >>> --- >>> block/backup.c | 14 ++++++++------ >>> block/dirty-bitmap.c | 39 >>> +++++++++++++++++++++++++++++++++------ >>> block/mirror.c | 24 +++++++++++++----------- >>> include/block/dirty-bitmap.h | 7 +++++-- >>> include/qemu/typedefs.h | 1 + >>> 5 files changed, 60 insertions(+), 25 deletions(-) >>> [...] >>> @@ -224,6 +231,7 @@ static void >>> bdrv_do_release_matching_dirty_bitmap(BlockDriverState *bs, >>> BdrvDirtyBitmap *bm, *next; >>> QLIST_FOREACH_SAFE(bm, &bs->dirty_bitmaps, list, next) { >>> if ((!bitmap || bm =3D=3D bitmap) && (!only_named || bm->na= me)) { >>> + assert(!bitmap->active_iterators); >> No good -- this function is also used to clear out all named bitmaps >> belonging to a BDS, so 'bitmap' may be NULL, so this assertion is bad.= >=20 > Just a note about this. I do not like this hidden behaviour of > release_bitmap, as it more native for freeing functions to do nothing > with NULL pointer.. g_free(NULL) do not free all allocations))).. If > someone agrees, this may be better to be changed. The function is not called "bdrv_release_dirty_bitmap()", though, but "bdrv_do_release_matching_dirty_bitmap()". The "do" means that it's an internal function, called only by bdrv_release_dirty_bitmap() (aha!) and bdrv_release_named_dirty_bitmaps(); and the "matching" means that if you pass NULL, it'll release all bitmaps. What we could do is make bdrv_release_dirty_bitmap() a no-op if NULL is passed, or add an assertion that the argument is not NULL. I'd be fine with either, but I don't think bdrv_do_release_matching_dirty_bitmap() needs to be adjusted. Max --BrVXbrN1rqlkDIoSTpoVPldd9Gc2KJgaT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXhhOFEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrTAL B/wL9Qv++fQzk0F1j/4HeoMO9eC5og3Xc7h7qJMK+5zTgsdhXpzdls1EF2escT+G UY3yWBc7jYtv7Pie0ZRDu2JE3AM6iZQThBhQq0mGQTlmtDERjUh9RNoMmGBTYYv/ 0PnyFA1Y29T+m3LImrLnBDc890de8zXCqedpKqD+U7Jo9sFTrsvlT0YpIukHG30/ j3s/B897+K0QCc0lTOcLLNmlOQ9kffB2cVw11Ld4gaQxfK4H8K71ECefwBpi6ZOQ ABD5S1rnPkEOWr27s4iDnCdpKckpn77qAO1pyBwwvyepfGCAZlVvobYyLpkVM8oM /A/pWTHnM6rcEHztv7vn8DZq =RTkC -----END PGP SIGNATURE----- --BrVXbrN1rqlkDIoSTpoVPldd9Gc2KJgaT--