Re: [Qemu-devel] [PATCH 07/17] nbd: convert to use qio_channel_yield

2017-01-31 Thread Paolo Bonzini
On 31/01/2017 08:50, Stefan Hajnoczi wrote: >> I'm not sure a >> comment in the NBD driver is the best place, because similar logic will >> appear soon in other networked block drivers. > Maybe add a new function that just does these two calls. I don't have a > good name for it. For now I'll ad

Re: [Qemu-devel] [PATCH 07/17] nbd: convert to use qio_channel_yield

2017-01-31 Thread Stefan Hajnoczi
On Mon, Jan 30, 2017 at 04:18:10PM -0500, Paolo Bonzini wrote: > On 30/01/2017 10:50, Stefan Hajnoczi wrote: > > On Fri, Jan 20, 2017 at 05:43:12PM +0100, Paolo Bonzini wrote: > >> +aio_co_wake(s->recv_coroutine[i]); > >> > >> -qemu_coroutine_enter(nbd_get_client_session(bs)->send_cor

Re: [Qemu-devel] [PATCH 07/17] nbd: convert to use qio_channel_yield

2017-01-30 Thread Paolo Bonzini
On 30/01/2017 10:50, Stefan Hajnoczi wrote: > On Fri, Jan 20, 2017 at 05:43:12PM +0100, Paolo Bonzini wrote: >> +aio_co_wake(s->recv_coroutine[i]); >> >> -qemu_coroutine_enter(nbd_get_client_session(bs)->send_coroutine); >> +/* We're woken up by the recv_coroutine itself. *

Re: [Qemu-devel] [PATCH 07/17] nbd: convert to use qio_channel_yield

2017-01-30 Thread Stefan Hajnoczi
On Fri, Jan 20, 2017 at 05:43:12PM +0100, Paolo Bonzini wrote: > +aio_co_wake(s->recv_coroutine[i]); > > -qemu_coroutine_enter(nbd_get_client_session(bs)->send_coroutine); > +/* We're woken up by the recv_coroutine itself. */ > +qemu_coroutine_yield(); This relies on

[Qemu-devel] [PATCH 07/17] nbd: convert to use qio_channel_yield

2017-01-20 Thread Paolo Bonzini
In the client, read the reply headers from a coroutine, switching the read side between the "read header" coroutine and the I/O coroutine that reads the body of the reply. In the server, if the server can read more requests it will create a new "read request" coroutine as soon as a request has bee