[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous |
Date: |
Thu, 29 Aug 2013 14:29:22 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Aug 09, 2013 at 07:43:55PM +0200, Charlie Shepherd wrote:
> +static int qcow2_open(BlockDriverState *bs, QDict *options, int flags)
> +{
> + Coroutine *co;
> + struct QOpenCo qo = {
> + .bs = bs,
> + .options = options,
> + .flags = flags,
> + .ret = NOT_DONE,
> + };
> +
> + co = qemu_coroutine_create(qcow2_co_open_entry);
> + qemu_coroutine_enter(co, &qo);
> + while (qo.ret == NOT_DONE) {
> + qemu_aio_wait();
> + }
I think a cleaner approach is a bool qo.done field instead of using a
magic NOT_DONE value. This way the return value of qcow2_co_open() can
never collide with NOT_DONE.
(In block.c we use NOT_DONE but I'd like to start using a separate field
to indicate completion in new places.)
- [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 03/15] Explicitly mark BlockDriver function .bdrv_create as coroutine and rename it bdrv_co_create., Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 07/15] Call bdrv->open via a synchronous wrapper in block/snapshot.c, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 06/15] Explicitly mark BlockDriver functions .bdrv_write and .bdrv_read as coroutine functions, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 08/15] Convert bdrv_create and associated functions to be coroutine_fn, Charlie Shepherd, 2013/08/09