On 09/09/2011 05:03 PM, Paolo Bonzini wrote:
I'm a bit unsure here, actually. So you lock a mutex, send a request,
wait for a response, then unlock the mutex. Surely this code doesn't
allow more than one request to be in flight at a time?
No, it doesn't. It shouldn't be hard to do it though. You could have
two mutexes, one for sending and one for receiving. You yield after
sending, and let nbd_coroutine_restart read the reply. It can then
reenter that reply's coroutine based on the handle in the reply. I
still prefer to do it in a separate patch.
There is a problem with discard requests because they are not coroutine
based (yet). But it would be the same even in your AIO implementation,
unfortunately.
Paolo