Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-26 Thread Fam Zheng
On Tue, Nov 26, 2013 at 6:41 PM, Paolo Bonzini wrote: > Il 26/11/2013 11:31, Fam Zheng ha scritto: >>> > I would just use an uint64_t, I think you have ~20 operations now. >>> > There is still quite some breathing room. >>> > >> OK. Then, can we still use QAPI enum? Because I think being possible

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-26 Thread Paolo Bonzini
Il 26/11/2013 11:31, Fam Zheng ha scritto: >> > I would just use an uint64_t, I think you have ~20 operations now. >> > There is still quite some breathing room. >> > > OK. Then, can we still use QAPI enum? Because I think being possible > to query blockers makes sense, that way the user doesn't ha

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-26 Thread Fam Zheng
On Tue, Nov 26, 2013 at 5:22 PM, Paolo Bonzini wrote: > Il 26/11/2013 03:07, Fam Zheng ha scritto: +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 BlockOp

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-26 Thread Fam Zheng
On Tue, Nov 26, 2013 at 6:25 PM, Paolo Bonzini wrote: > Il 26/11/2013 11:19, Fam Zheng ha scritto: >>> So that you can add the same Error to multiple items of the array with a >>> single bdrv_op_block call (by ORing them into the second parameter). >> >> What data type to contain this? I'm not sur

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-26 Thread Paolo Bonzini
Il 26/11/2013 11:19, Fam Zheng ha scritto: >> So that you can add the same Error to multiple items of the array with a >> single bdrv_op_block call (by ORing them into the second parameter). > > What data type to contain this? I'm not sure 64 is enough in long term... I would just use an uint64_t

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-26 Thread Paolo Bonzini
Il 26/11/2013 03:07, Fam Zheng ha scritto: >>> >>> +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

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-25 Thread Fam Zheng
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)); +bl

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-25 Thread Paolo Bonzini
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; > +Q

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-25 Thread Kevin Wolf
Am 22.11.2013 um 06:24 hat Fam Zheng geschrieben: > BlockDriverState.op_blockers is an array of list with BLOCK_OP_TYPE_MAX > elements. Each list is a list of blockers of an operation type > (BlockOpType), that marks this BDS is currently blocked for certain type > of operation with reason errors s

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-25 Thread Kevin Wolf
Am 22.11.2013 um 06:24 hat Fam Zheng geschrieben: > BlockDriverState.op_blockers is an array of list with BLOCK_OP_TYPE_MAX s/list/lists/ > elements. Each list is a list of blockers of an operation type > (BlockOpType), that marks this BDS is currently blocked for certain type s/is/as/ s/for/for

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-22 Thread Stefan Hajnoczi
On Fri, Nov 22, 2013 at 01:24:49PM +0800, Fam Zheng wrote: > +bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error **errp) > +{ > +BdrvOpBlocker *blocker; > +assert(op >=0 && op < BLOCK_OP_TYPE_MAX); > +if (!QLIST_EMPTY(&bs->op_blockers[op])) { > +blocker = QLIST_

[Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState

2013-11-21 Thread Fam Zheng
BlockDriverState.op_blockers is an array of list with BLOCK_OP_TYPE_MAX elements. Each list is a list of blockers of an operation type (BlockOpType), that marks this BDS is currently blocked for certain type of operation with reason errors stored in the list. The rule of usage is: * BDS user who