From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQ147-0006RH-Bq for qemu-devel@nongnu.org; Mon, 23 Feb 2015 17:01:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQ143-0006Uh-5q for qemu-devel@nongnu.org; Mon, 23 Feb 2015 17:01:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35406) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQ142-0006TO-T6 for qemu-devel@nongnu.org; Mon, 23 Feb 2015 17:01:19 -0500 Message-ID: <54EBA326.9050900@redhat.com> Date: Mon, 23 Feb 2015 17:01:10 -0500 From: Max Reitz MIME-Version: 1.0 References: <1423710438-14377-1-git-send-email-wency@cn.fujitsu.com> <1423710438-14377-11-git-send-email-wency@cn.fujitsu.com> In-Reply-To: <1423710438-14377-11-git-send-email-wency@cn.fujitsu.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 10/14] allow the backing image access the origin BlockDriverState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang , qemu devel , Kevin Wolf , Stefan Hajnoczi , Paolo Bonzini Cc: Lai Jiangshan , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , Gonglei , Yang Hongyang , zhanghailiang On 2015-02-11 at 22:07, Wen Congyang wrote: > Block replication needs this feature. > > Signed-off-by: Wen Congyang > Signed-off-by: zhanghailiang > Signed-off-by: Gonglei > --- > block.c | 2 ++ > include/block/block_int.h | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/block.c b/block.c > index a7a8932..067c44b 100644 > --- a/block.c > +++ b/block.c > @@ -1181,6 +1181,7 @@ void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd) > if (bs->backing_hd) { > assert(bs->backing_blocker); > bdrv_op_unblock_all(bs->backing_hd, bs->backing_blocker); > + bs->backing_hd->origin_file = NULL; Seems more like "backed_file" to me. Can you explain to me where "origin file" comes from? Since apparently one BDS can be used as a backing file by only at most one other BDS, the patch seems fine to me (other than the naming issue). Max > } else if (backing_hd) { > error_setg(&bs->backing_blocker, > "device is used as backing hd of '%s'", > @@ -1193,6 +1194,7 @@ void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd) > bs->backing_blocker = NULL; > goto out; > } > + backing_hd->origin_file = bs; > bs->open_flags &= ~BDRV_O_NO_BACKING; > pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_hd->filename); > pstrcpy(bs->backing_format, sizeof(bs->backing_format), > diff --git a/include/block/block_int.h b/include/block/block_int.h > index 603f704..9be13a8 100644 > --- a/include/block/block_int.h > +++ b/include/block/block_int.h > @@ -360,6 +360,8 @@ struct BlockDriverState { > char exact_filename[PATH_MAX]; > > BlockDriverState *backing_hd; > + /* used by backing image */ > + BlockDriverState *origin_file; > BlockDriverState *file; > > NotifierList close_notifiers;