From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl841-0002Zq-DW for qemu-devel@nongnu.org; Mon, 25 Nov 2013 21:07:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl83v-0000SP-D9 for qemu-devel@nongnu.org; Mon, 25 Nov 2013 21:07:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl83v-0000SC-4H for qemu-devel@nongnu.org; Mon, 25 Nov 2013 21:07:39 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAQ27cQs006564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Nov 2013 21:07:38 -0500 Message-ID: <52940262.2090406@redhat.com> Date: Tue, 26 Nov 2013 10:07:30 +0800 From: Fam Zheng MIME-Version: 1.0 References: <1385097894-1380-1-git-send-email-famz@redhat.com> <1385097894-1380-3-git-send-email-famz@redhat.com> <52938532.1080803@redhat.com> In-Reply-To: <52938532.1080803@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, hbrock@redhat.com, qemu-devel@nongnu.org, rjones@redhat.com, imain@redhat.com, stefanha@redhat.com On 2013=E5=B9=B411=E6=9C=8826=E6=97=A5 01:13, Paolo Bonzini wrote: > Il 22/11/2013 06:24, Fam Zheng ha scritto: >> +void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reaso= n) >> +{ >> + BdrvOpBlocker *blocker; >> + assert(op >=3D0 && op < BLOCK_OP_TYPE_MAX); >> + >> + blocker =3D g_malloc0(sizeof(BdrvOpBlocker)); >> + blocker->reason =3D reason; >> + QLIST_INSERT_HEAD(&bs->op_blockers[op], blocker, list); >> +} >> + >> +void bdrv_op_unblock(BlockDriverState *bs, BlockOpType op, Error *rea= son) > > What about making BlockOpType a bitmask, and having bdrv_op_{,un}block > take multiple ORed BlockOpTypes? > > bdrv_op_{,un}block_all then are not necessary, you only need a > BLOCK_OPERATION_ALL value. > Bitmap is not enough, at least it should be an array. For example when=20 we enable multiple block jobs, there're two stoppers for drive_del, right= ? And a bool or int is not as friendly as an error message, because when=20 an operation is blocked we can't print a specific reason when we don't=20 have this information at all. So let's be consistent with migration=20 blockers. Fam