From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzhsE-0002v5-UW for qemu-devel@nongnu.org; Thu, 18 Jul 2013 02:39:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzhsC-0006ng-1U for qemu-devel@nongnu.org; Thu, 18 Jul 2013 02:39:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzhsB-0006nR-Ox for qemu-devel@nongnu.org; Thu, 18 Jul 2013 02:39:31 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6I6dU9c005139 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Jul 2013 02:39:31 -0400 Date: Thu, 18 Jul 2013 14:39:28 +0800 From: Fam Zheng Message-ID: <20130718063928.GH29052@T430s.nay.redhat.com> References: <1374091462-18391-1-git-send-email-imain@redhat.com> <1374091462-18391-4-git-send-email-imain@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1374091462-18391-4-git-send-email-imain@redhat.com> Subject: Re: [Qemu-devel] [PATCH V4 3/4] Add backing drive while performing backup. Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ian Main , Paolo Bonzini Cc: qemu-devel@nongnu.org On Wed, 07/17 13:04, Ian Main wrote: > This patch adds the original source drive as a backing drive to our target > image so that the target image will appear complete during backup. This > is especially useful for SYNC_MODE_NONE as it allows export via NBD to > have a complete point-in-time snapshot available for export. > > Signed-off-by: Ian Main > --- > block/backup.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/block/backup.c b/block/backup.c > index 68abd23..e086e76 100644 > --- a/block/backup.c > +++ b/block/backup.c > @@ -323,6 +323,10 @@ static void coroutine_fn backup_run(void *opaque) > > hbitmap_free(job->bitmap); > > + /* Set the target backing drive back to NULL before calling delete or > + * it will also delete the underlying drive. */ > + target->backing_hd = NULL; > + > bdrv_iostatus_disable(target); > bdrv_delete(target); > > @@ -362,6 +366,15 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, > return; > } > > + /* Manually set the backing hd to be the backup source drive so > + * that all reads done while we are backing up will be passed > + * on to the original source drive. This allows reading from the > + * image while the backup is in progress, or in the case of > + * SYNC_MODE_NONE allows a complete image to be present for export. > + * Note that we do this for all modes including SYNC_MODE_TOP as > + * even then it allows on-the-fly reading. */ > + target->backing_hd = bs; > + Also set target->backing_file and target->backing_format here? Paolo? Thanks. Fam