From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0EB-0006Oq-43 for qemu-devel@nongnu.org; Wed, 06 May 2015 10:23:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yq0E7-00011J-1k for qemu-devel@nongnu.org; Wed, 06 May 2015 10:23:11 -0400 Message-ID: <554A23BE.2070006@redhat.com> Date: Wed, 06 May 2015 16:22:54 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1430911419-8256-1-git-send-email-famz@redhat.com> <1430911419-8256-4-git-send-email-famz@redhat.com> In-Reply-To: <1430911419-8256-4-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, jcody@redhat.com, armbru@redhat.com, mreitz@redhat.com, Stefan Hajnoczi 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. 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? Paolo