On 10/14/2011 03:20 PM, Stefan Hajnoczi wrote:
It's just too tempting to call these functions in contexts where it is not okay to do so. The bdrv_co_*() functions are all tagged as coroutine_fn and make it clear that they can yield.
Yes, I agree.
We already have an event loop in qemu-img except it's the nested event loop in synchronous bdrv_*() emulation functions. The nested event loop is a mini event loop and can't really do things like timers. It would be nicer to remove it in favor of a single top-level event loop with the qemu-img code running in a coroutine.
Note that the nested event loop cannot go away because of qemu_aio_flush, though. :(
Paolo