From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFOHs-0006hQ-91 for qemu-devel@nongnu.org; Mon, 17 Feb 2014 08:31:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFOHm-0004dj-AB for qemu-devel@nongnu.org; Mon, 17 Feb 2014 08:31:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFOHm-0004dR-31 for qemu-devel@nongnu.org; Mon, 17 Feb 2014 08:31:02 -0500 Date: Mon, 17 Feb 2014 21:30:06 +0800 From: Fam Zheng Message-ID: <20140217133006.GD1428@T430.redhat.com> References: <1390972061-26560-1-git-send-email-famz@redhat.com> <1390972061-26560-3-git-send-email-famz@redhat.com> <20140213122400.GA4547@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20140213122400.GA4547@irqsave.net> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v13 02/14] block: Introduce op_blockers to BlockDriverState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: kwolf@redhat.com, rjones@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, imain@redhat.com, stefanha@redhat.com, pbonzini@redhat.com On Thu, 02/13 13:24, Beno=EEt Canet wrote: > The Wednesday 29 Jan 2014 =E0 13:07:29 (+0800), Fam Zheng wrote : > > +bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error = **errp) > > +{ > > + BdrvOpBlocker *blocker; > > + assert((int) op >=3D 0 && op < BLOCK_OP_TYPE_MAX); > > + if (!QLIST_EMPTY(&bs->op_blockers[op])) { > > + blocker =3D QLIST_FIRST(&bs->op_blockers[op]); > > + if (errp) { > > + *errp =3D error_copy(blocker->reason); >=20 > When an operation is blocked the first reason found is returned as **er= rp. >=20 > I think that this could lead to some randomization of the error message= s > depending on the bdrv_op_block call order. >=20 This is not randomization IMO. I think for a program that could fail with more than one reasons, it fail= s on and reports the first failure. This behavior is not uncommon. Being verbo= se here does not show much more help, but it's still very easy to add later = when users asks for it. Fam