From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVxhP-0004Yw-8r for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:47:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVxhO-0003Ez-Eg for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:47:35 -0500 Date: Tue, 24 Jan 2017 17:46:29 +0800 From: Fam Zheng Message-ID: <20170124094629.GB14811@lemon.Home> References: <1482503344-6424-1-git-send-email-vsementsov@virtuozzo.com> <1482503344-6424-3-git-send-email-vsementsov@virtuozzo.com> <20170124070938.GB27126@lemon.Home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 02/21] backup: init copy_bitmap from sync_bitmap for incremental List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com, jsnow@redhat.com, den@openvz.org, stefanha@redhat.com, pbonzini@redhat.com, jcody@redhat.com On Tue, 01/24 12:00, Vladimir Sementsov-Ogievskiy wrote: > > > static void coroutine_fn backup_run(void *opaque) > > > { > > > BackupBlockJob *job = opaque; > > > @@ -453,20 +481,22 @@ static void coroutine_fn backup_run(void *opaque) > > > end = DIV_ROUND_UP(job->common.len, job->cluster_size); > > > job->copy_bitmap = hbitmap_alloc(end, 0); > > > - hbitmap_set(job->copy_bitmap, 0, end); > > > job->before_write.notify = backup_before_write_notify; > > > bdrv_add_before_write_notifier(bs, &job->before_write); > > > if (job->sync_mode == MIRROR_SYNC_MODE_NONE) { > > > + hbitmap_set(job->copy_bitmap, 0, end); > > This is confusing. It seems job->copy_bitmap is actually a superset of clusters > > to copy instead of the exact one? Because "none" mode doesn't need blanket copy > > - only overwritten clusters are copied... > > We can't guess, what clusters should be copied finally in none mode. None > mode is done by allowing only notifier handling and no linear copying. But > notifier handling will copy only clusters marked in copy_bitmap, so I set it > from 0 to end. Yes, that's how I understand it too, what I dislike is this bit of inconsistency with it: "allowed to copy bitmap" here versus "planned to copy" in other modes. I don't know how to improve that, but I think at least the specialty of none mode could be mentioned in the comment of copy_bitmap.