On Thu, Jul 28, 2011 at 1:35 PM, Kevin Wolf <kw...@redhat.com> wrote: > Am 28.07.2011 14:09, schrieb Christoph Hellwig: >> On Wed, Jul 27, 2011 at 01:37:31PM +0100, Stefan Hajnoczi wrote: >>> Coroutines in the block layer [Kevin] >>> * Programming model to simplify block drivers without blocking QEMU threads >> >> Can anyone explain what the whole point of this is? It really just is >> a bit of syntactic sugar for the current async state machines. What does >> it buy us over going for real threading? > > The only current block driver that really does everything in an async > state machine is qed. It's definitely not nice code, and having to > convert all of the other block drivers to this would be a lot of work.
Thanks Kevin :). I do agree with the clumsiness of async callback programming - a lot of code is spent bundling and unbundling variables to pass between functions, not to mention that the control flow is much harder to follow. > So if it only means that we're making things async that would block the > VCPU until now, isn't that a great improvement already? > > The advantage compared to threading is that it allows an easy and > incremental transition. Also remember that we already have a threads-based implementation of coroutines. Later on we can do fine-grained locking and switch to threads directly instead of coroutines, if need be. Stefan