Received: from eggs.gnu.org ([2001:4830:134:3::10]:33549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQiRh-0004Da-Nj for qemu-devel@nongnu.org; Fri, 22 Jul 2016 17:57:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQiRf-0002vW-Px for qemu-devel@nongnu.org; Fri, 22 Jul 2016 17:57:24 -0400 References: <1468875431-16646-1-git-send-email-jsnow@redhat.com> <1468875431-16646-5-git-send-email-jsnow@redhat.com> From: Max Reitz Message-ID: Date: Fri, 22 Jul 2016 23:57:12 +0200 MIME-Version: 1.0 In-Reply-To: <1468875431-16646-5-git-send-email-jsnow@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bq2uamxROe044kCriNpH1FBJgE20HwmLV" Subject: Re: [Qemu-devel] [PATCH v7 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) --bq2uamxROe044kCriNpH1FBJgE20HwmLV From: Max Reitz To: John Snow , qemu-block@nongnu.org Cc: vsementsov@virtuozzo.com, famz@redhat.com, qemu-devel@nongnu.org Message-ID: Subject: Re: [PATCH v7 04/10] block: Support meta dirty bitmap References: <1468875431-16646-1-git-send-email-jsnow@redhat.com> <1468875431-16646-5-git-send-email-jsnow@redhat.com> In-Reply-To: <1468875431-16646-5-git-send-email-jsnow@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 18.07.2016 22:57, 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(+) [...] > +int bdrv_dirty_bitmap_get_meta(BlockDriverState *bs, > + BdrvDirtyBitmap *bitmap, int64_t sector= , > + int nb_sectors) > +{ > + uint64_t i; > + int gran =3D hbitmap_granularity(bitmap->meta); /me is making a note first: If John says an optimization may be premature, it probably is. Did I say hbitmap_granularity()? I may have wanted to actually say "1 << hbitmap_granularity()". Sorry. :-/ /me is making a second note now: Look up how something works before proposing it, not after someone has actually followed your advice. Max > + > + /* To optimize: we can make hbitmap to internally check the range = in a > + * coarse level, or at least do it word by word. */ > + for (i =3D sector; i < sector + nb_sectors; i +=3D gran) { > + if (hbitmap_get(bitmap->meta, i)) { > + return true; > + } > + } > + return false; > +} --bq2uamxROe044kCriNpH1FBJgE20HwmLV 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 iQEvBAEBCAAZBQJXkpa4EhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrUGD B/0cfmGVikoh5Qt8qyzUGu/AOWYvNLf1PGEy+vK9+i3YaTkSlPMXapkcJ1v3PCV6 9N0t4kxOXpD5zrYExwiLSxZYWQ9NG0j+9ETZaRJaULgOA3fS9p9tkfqRTIBgyPUQ RL0ulpU2w7UhctTS0zIaaCp5NtOpHWdwhTVIPUesbGtwuV2MFO1Ns/oAfg5QccpU SoFURPJRo+3rBxppta4vJRE+db5SSJ/1YSv+wtT0CctZNfjyYrxgqYaYPNyLXRab utbruyWOASt0yybj5QiUTcPEuCHRfxCaqcYNqpAGccA91eLSj4PG0z8gmyunMDUA rP3pEwiaee3zkLPVlxG7KraB =Ed3u -----END PGP SIGNATURE----- --bq2uamxROe044kCriNpH1FBJgE20HwmLV--