|
From: | Fam Zheng |
Subject: | Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState |
Date: | Tue, 26 Nov 2013 10:07:30 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 |
On 2013年11月26日 01:13, Paolo Bonzini wrote:
Il 22/11/2013 06:24, Fam Zheng ha scritto:+void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reason) +{ + BdrvOpBlocker *blocker; + assert(op >=0 && op < BLOCK_OP_TYPE_MAX); + + blocker = g_malloc0(sizeof(BdrvOpBlocker)); + blocker->reason = reason; + QLIST_INSERT_HEAD(&bs->op_blockers[op], blocker, list); +} + +void bdrv_op_unblock(BlockDriverState *bs, BlockOpType op, Error *reason)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 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 an operation is blocked we can't print a specific reason when we don't have this information at all. So let's be consistent with migration blockers.
Fam
[Prev in Thread] | Current Thread | [Next in Thread] |