Received: from eggs.gnu.org ([2001:4830:134:3::10]:49589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmU5y-00045b-Bz for qemu-devel@nongnu.org; Mon, 19 May 2014 16:23:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmU5q-0002nO-K4 for qemu-devel@nongnu.org; Mon, 19 May 2014 16:23:38 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:201:233:1::3]:35971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmU5q-0002n0-Cp for qemu-devel@nongnu.org; Mon, 19 May 2014 16:23:30 -0400 Received: from blackfin.pond.sub.org (p5B32BA71.dip0.t-ipconnect.de [91.50.186.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by oxygen.pond.sub.org (Postfix) with ESMTPSA id 59E9424768 for ; Mon, 19 May 2014 22:23:27 +0200 (CEST) From: Markus Armbruster References: <1399858555-9672-1-git-send-email-famz@redhat.com> <1399858555-9672-8-git-send-email-famz@redhat.com> <537A5CE9.9020801@redhat.com> Date: Mon, 19 May 2014 22:23:27 +0200 In-Reply-To: <537A5CE9.9020801@redhat.com> (Eric Blake's message of "Mon, 19 May 2014 13:35:05 -0600") Message-ID: <871tvpa56o.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v19 07/16] block: Add backing_blocker in BlockDriverState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, Fam Zheng , jcody@redhat.com, hbrock@redhat.com, qemu-devel@nongnu.org, rjones@redhat.com, imain@redhat.com, stefanha@redhat.com, pbonzini@redhat.com Eric Blake writes: > On 05/11/2014 07:35 PM, 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 | 24 ++++++++++++++++++++---- >> block/mirror.c | 1 + >> include/block/block_int.h | 3 +++ >> 3 files changed, 24 insertions(+), 4 deletions(-) >> >> diff --git a/block.c b/block.c >> index ec26a2b..8155e68 100644 >> --- a/block.c >> +++ b/block.c >> @@ -1097,14 +1097,31 @@ fail: >> void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd) >> { >> >> + if (bs->backing_hd) { >> + assert(error_is_set(&bs->backing_blocker)); > > error_is_set() is going away. Please don't use it. > https://lists.gnu.org/archive/html/qemu-devel/2014-05/msg03801.html > > This can just be assert(bs->backing_blocker). Yes. See commit 0fb6395. Another instance in PATCH 14. >> + 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) { >> + if (error_is_set(&bs->backing_blocker)) { >> + error_free(bs->backing_blocker); > > if (bs->backing_blocker) { Actually, unconditional error_free(bs->backing_blocker) is fine.