From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnouE-0003OV-J2 for qemu-devel@nongnu.org; Fri, 23 May 2014 08:49:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wnou4-0005me-5n for qemu-devel@nongnu.org; Fri, 23 May 2014 08:49:01 -0400 Received: from mail-ee0-x22b.google.com ([2a00:1450:4013:c00::22b]:57348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wnou3-0005mW-Uu for qemu-devel@nongnu.org; Fri, 23 May 2014 08:48:52 -0400 Received: by mail-ee0-f43.google.com with SMTP id d17so3611710eek.16 for ; Fri, 23 May 2014 05:48:51 -0700 (PDT) Date: Fri, 23 May 2014 14:46:31 +0200 From: Stefan Hajnoczi Message-ID: <20140523124631.GA5990@stefanha-thinkpad.hitronhub.home> References: <1400815403-7719-1-git-send-email-famz@redhat.com> <1400815403-7719-8-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1400815403-7719-8-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH 7/7] block: Add backing_blocker in BlockDriverState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , Benoit Canet , jcody@redhat.com, qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , Paolo Bonzini On Fri, May 23, 2014 at 11:23:23AM +0800, Fam Zheng wrote: > This makes use of op_blocker and blocks all the operations except for > commit target, on each BlockDriverState->backing_hd. > > The asserts for op_blocker in bdrv_swap are removed because with this > change, the target of block commit has at least the backing blocker of > its child, so the assertion is not true. Callers should do their check. > > Signed-off-by: Fam Zheng > --- > block.c | 22 ++++++++++++++++++---- > block/mirror.c | 2 +- > include/block/block_int.h | 3 +++ > 3 files changed, 22 insertions(+), 5 deletions(-) > > diff --git a/block.c b/block.c > index 91c866c..b5aeca2 100644 > --- a/block.c > +++ b/block.c > @@ -1097,14 +1097,29 @@ fail: > 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); > + } else if (backing_hd) { > + error_setg(&bs->backing_blocker, > + "device is used as backing hd of '%s'", > + bs->device_name); > + } > + > bs->backing_hd = backing_hd; > if (!backing_hd) { > + error_free(bs->backing_blocker); bs->backing_block = NULL; ...to make the assert(bs->backing_blocker) above more useful.