From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxF7c-0006y4-Ij for qemu-devel@nongnu.org; Mon, 21 Jan 2013 06:01:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxF7Z-0007PY-SC for qemu-devel@nongnu.org; Mon, 21 Jan 2013 06:01:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxF7Z-0007PI-Jo for qemu-devel@nongnu.org; Mon, 21 Jan 2013 06:00:57 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0LB0s7A017574 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 Jan 2013 06:00:56 -0500 Message-ID: <50FD1FE0.2040701@redhat.com> Date: Mon, 21 Jan 2013 12:00:48 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1358357479-7912-1-git-send-email-pbonzini@redhat.com> <1358357479-7912-9-git-send-email-pbonzini@redhat.com> In-Reply-To: <1358357479-7912-9-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 08/12] mirror: allow customizing the granularity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com Am 16.01.2013 18:31, schrieb Paolo Bonzini: > The desired granularity may be very different depending on the kind of > operation (e.g. continuous replication vs. collapse-to-raw) and whether > the VM is expected to perform lots of I/O while mirroring is in progress. > > Allow the user to customize it, while providing a sane default so that > in general there will be no extra allocated space in the target compared > to the source. > > Signed-off-by: Paolo Bonzini > @@ -72,19 +70,19 @@ static int coroutine_fn mirror_iteration(MirrorBlockJob *s, > * is very large, we need to do COW ourselves. The first time a cluster is > * copied, copy it entirely. > * > - * Because both BDRV_SECTORS_PER_DIRTY_CHUNK and the cluster size are > - * powers of two, the number of sectors to copy cannot exceed one cluster. > + * Because both the granularity and the cluster size are powers of two, the > + * number of sectors to copy cannot exceed one cluster. > */ > sector_num = s->sector_num; > - nb_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK; > - cluster_num = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK; > + nb_sectors_chunk = nb_sectors = s->granularity >> BDRV_SECTOR_BITS; When you respin anyway: sectors_per_chunk would be a clearer name, I think. I'd also avoid double assignments, but the coding style document doesn't seem to forbid it. > @@ -962,6 +963,7 @@ Arguments: > file/device (NewImageMode, optional, default 'absolute-paths') > - "speed": maximum speed of the streaming job, in bytes per second > (json-int) > +- "granularity": granularity of the dirty bitmap, in bytes (json-int, optional) > - "sync": what parts of the disk image should be copied to the destination; > possibilities include "full" for all the disk, "top" for only the sectors > allocated in the topmost image, or "none" to only replicate new I/O > @@ -971,6 +973,10 @@ Arguments: > - "on-target-error": the action to take on an error on the target > (BlockdevOnError, default 'report') > > +The default value of the granularity is, if the image format defines > +a cluster size, the cluster size or 4096, whichever is larger. If it > +does not define a cluster size, the default value of the granularity > +is 65536. This doesn't match the code which has an upper limit of 64k for the granularity, even with larger cluster sizes. Kevin