From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjnmW-0004uy-C8 for qemu-devel@nongnu.org; Sat, 15 Dec 2012 04:11:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjnmV-0001zs-8Z for qemu-devel@nongnu.org; Sat, 15 Dec 2012 04:11:40 -0500 Received: from mx4-phx2.redhat.com ([209.132.183.25]:51460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjnmV-0001zg-16 for qemu-devel@nongnu.org; Sat, 15 Dec 2012 04:11:39 -0500 Date: Sat, 15 Dec 2012 04:11:38 -0500 (EST) From: Paolo Bonzini Message-ID: <2045599128.24995094.1355562698577.JavaMail.root@redhat.com> In-Reply-To: <50CB99A8.2030606@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 07/20] block: allow customizing the granularity of the dirty bitmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com ----- Messaggio originale ----- > Da: "Eric Blake" > A: "Paolo Bonzini" > Cc: qemu-devel@nongnu.org, kwolf@redhat.com, stefanha@redhat.com, jcody@r= edhat.com > Inviato: Venerd=C3=AC, 14 dicembre 2012 22:27:04 > Oggetto: Re: [PATCH 07/20] block: allow customizing the granularity of th= e dirty bitmap >=20 > On 12/12/2012 06:46 AM, Paolo Bonzini wrote: > > Signed-off-by: Paolo Bonzini > > --- > > block-migration.c | 5 +++-- > > block.c | 17 ++++++++++------- > > block.h | 5 +---- > > block/mirror.c | 14 ++++---------- > > qapi-schema.json | 4 +++- > > 5 files changed, 21 insertions(+), 24 deletions(-) > >=20 >=20 > > @@ -4218,16 +4220,17 @@ void *qemu_blockalign(BlockDriverState *bs, > > size_t size) > > return qemu_memalign((bs && bs->buffer_alignment) ? > > bs->buffer_alignment : 512, size); > > } > > =20 > > -void bdrv_set_dirty_tracking(BlockDriverState *bs, int enable) > > +void bdrv_set_dirty_tracking(BlockDriverState *bs, int > > granularity) > > { > > int64_t bitmap_size; > > =20 > > - if (enable) { > > - if (!bs->dirty_bitmap) { > > - bitmap_size =3D (bdrv_getlength(bs) >> > > BDRV_SECTOR_BITS); > > - bs->dirty_bitmap =3D hbitmap_alloc(bitmap_size, > > - > > BDRV_LOG_SECTORS_PER_DIRTY_= CHUNK); > > - } > > + assert((granularity & (granularity - 1)) =3D=3D 0); > > + > > + if (granularity) { > > + granularity >>=3D BDRV_SECTOR_BITS; >=20 > Given that granularity is specified in bytes, does it make sense for > a user to want a granularity of 4G? No, the point of the HBitmap is to allow small granularities. Anything bigger than 1 or 2 MB makes little sense. Paolo