From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0rN-0004am-6J for qemu-devel@nongnu.org; Wed, 06 May 2015 11:03:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yq0rH-00085D-Ic for qemu-devel@nongnu.org; Wed, 06 May 2015 11:03:41 -0400 Date: Wed, 6 May 2015 23:03:25 +0800 From: Fam Zheng Message-ID: <20150506150325.GD1535@ad.nay.redhat.com> References: <1430911419-8256-1-git-send-email-famz@redhat.com> <1430911419-8256-4-git-send-email-famz@redhat.com> <554A23BE.2070006@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <554A23BE.2070006@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 3/7] block: Add op blocker notifier list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-block@nongnu.org, armbru@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, Stefan Hajnoczi On Wed, 05/06 16:22, Paolo Bonzini wrote: > > > On 06/05/2015 13:23, Fam Zheng wrote: > > void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reason) > > { > > BdrvOpBlocker *blocker; > > assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX); > > > > + bdrv_op_blocker_notify(bs, op, reason, true); > > blocker = g_new0(BdrvOpBlocker, 1); > > blocker->reason = reason; > > QLIST_INSERT_HEAD(&bs->op_blockers[op], blocker, list); > > @@ -3405,6 +3424,7 @@ void bdrv_op_unblock(BlockDriverState *bs, BlockOpType op, Error *reason) > > { > > BdrvOpBlocker *blocker, *next; > > assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX); > > + bdrv_op_blocker_notify(bs, op, reason, false); > > QLIST_FOREACH_SAFE(blocker, &bs->op_blockers[op], list, next) { > > if (blocker->reason == reason) { > > QLIST_REMOVE(blocker, list); > > Changed in the following patch. Bad git rebase -i, will fix. > > Also, should we only invoke the notifier if the list becomes > empty/non-empty? Is there any reason why the notifier would like to > know the particular Error that was added? > Good point, this can be simplified. Fam