From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP9zT-0002Am-WC for qemu-devel@nongnu.org; Mon, 18 Jul 2016 10:57:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP9zT-0004an-3d for qemu-devel@nongnu.org; Mon, 18 Jul 2016 10:57:51 -0400 References: <1468614461-28807-1-git-send-email-jsnow@redhat.com> <1468614461-28807-5-git-send-email-jsnow@redhat.com> From: Max Reitz Message-ID: <2a65d1cd-1b1d-7a40-9404-7cbeee1240da@redhat.com> Date: Mon, 18 Jul 2016 16:57:33 +0200 MIME-Version: 1.0 In-Reply-To: <1468614461-28807-5-git-send-email-jsnow@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AEmvwVRGm4jC0Nbc7ENTg4PBxgD1hD0Qx" Subject: Re: [Qemu-devel] [PATCH v6 04/10] block: Support meta dirty bitmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , qemu-block@nongnu.org Cc: vsementsov@virtuozzo.com, famz@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AEmvwVRGm4jC0Nbc7ENTg4PBxgD1hD0Qx From: Max Reitz To: John Snow , qemu-block@nongnu.org Cc: vsementsov@virtuozzo.com, famz@redhat.com, qemu-devel@nongnu.org Message-ID: <2a65d1cd-1b1d-7a40-9404-7cbeee1240da@redhat.com> Subject: Re: [PATCH v6 04/10] block: Support meta dirty bitmap References: <1468614461-28807-1-git-send-email-jsnow@redhat.com> <1468614461-28807-5-git-send-email-jsnow@redhat.com> In-Reply-To: <1468614461-28807-5-git-send-email-jsnow@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 15.07.2016 22:27, John Snow wrote: > From: Fam Zheng >=20 > The added group of operations enables tracking of the changed bits in > the dirty bitmap. >=20 > Signed-off-by: Fam Zheng > Reviewed-by: Max Reitz > Signed-off-by: John Snow > --- > block/dirty-bitmap.c | 52 ++++++++++++++++++++++++++++++++++++= ++++++++ > include/block/dirty-bitmap.h | 9 ++++++++ > 2 files changed, 61 insertions(+) >=20 > diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c > index 628b77c..9c53c56 100644 > --- a/block/dirty-bitmap.c > +++ b/block/dirty-bitmap.c > @@ -38,6 +38,7 @@ [...] > +int bdrv_dirty_bitmap_get_meta(BlockDriverState *bs, > + BdrvDirtyBitmap *bitmap, int64_t sector= , > + int nb_sectors) > +{ > + uint64_t i; > + int gran =3D bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_= BITS; > + > + /* To optimize: we can make hbitmap to internally check the range = in a > + * coarse level, or at least do it word by word. */ So you really want to leave even the simple optimizations for later? :-) (i.e. "int gran =3D hbitmap_granularity(bitmap->meta);") Max > + for (i =3D sector; i < sector + nb_sectors; i +=3D gran) { > + if (hbitmap_get(bitmap->meta, i)) { > + return true; > + } > + } > + return false; > +} --AEmvwVRGm4jC0Nbc7ENTg4PBxgD1hD0Qx 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 iQEvBAEBCAAZBQJXjO5dEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrYp9 B/0VJQ4WZSVTp2+D+SpRW7vaczYXPEaOZBb7bCWN89CwSZTDhen2utWitrd/2Q20 f8rpoT5mfNO3Q37WU/sVF9+rlMrukNugLdL0wy2wDaRY0UNpGmn4chJi7C+GN1f0 zLtTO3tIxz44OnIcKBuu6ujfdxBnJGMR3IxBXRW95EghYujHTxWJbFJ6DR/tx6WR fRglyEvwr2nleZKmLBia6qspjXDC5Rwvr5ASy6gH/dAOveeNEOhCAtuikOm7HlS6 WVNzBwxn6RWqFdkVOeJW8zoyTvTlea97v1mZ6fPxrCL5kDILnv4fChCifkjJGDQZ 9EQoWtoWNwgJl/IBge6BAAjN =I9Fy -----END PGP SIGNATURE----- --AEmvwVRGm4jC0Nbc7ENTg4PBxgD1hD0Qx--