Re: [Qemu-devel] [PATCH 06/16] nbd: do not block on partial reply header reads

2017-01-18 Thread Paolo Bonzini
On 18/01/2017 16:24, Stefan Hajnoczi wrote: > On Fri, Jan 13, 2017 at 02:17:21PM +0100, Paolo Bonzini wrote: >> @@ -65,54 +67,34 @@ static void nbd_teardown_connection(BlockDriverState *bs) >> client->ioc = NULL; >> } >> >> -static void nbd_reply_ready(void *opaque) >> +static void nbd_re

Re: [Qemu-devel] [PATCH 06/16] nbd: do not block on partial reply header reads

2017-01-18 Thread Stefan Hajnoczi
On Fri, Jan 13, 2017 at 02:17:21PM +0100, Paolo Bonzini wrote: > @@ -65,54 +67,34 @@ static void nbd_teardown_connection(BlockDriverState *bs) > client->ioc = NULL; > } > > -static void nbd_reply_ready(void *opaque) > +static void nbd_read_reply_entry(void *opaque) Please use coroutine_fn.

Re: [Qemu-devel] [PATCH 06/16] nbd: do not block on partial reply header reads

2017-01-16 Thread Paolo Bonzini
On 16/01/2017 13:52, Fam Zheng wrote: > +/* Kick the read_reply_co to get the next reply. */ > +aio_co_wake(s->read_reply_co); > > Can't s->read_reply_co be NULL? nbd_read_reply_entry unsets it. (Surprisingly > this file is rather unfamiliar to me, it's possible I'm missing something.)

Re: [Qemu-devel] [PATCH 06/16] nbd: do not block on partial reply header reads

2017-01-16 Thread Fam Zheng
On Fri, 01/13 14:17, Paolo Bonzini wrote: > Read the replies from a coroutine, switching the read side between the > "read header" coroutine and the I/O coroutine that reads the body of > the reply. > > qio_channel_yield is used so that the right coroutine is restarted > automatically, eliminating

[Qemu-devel] [PATCH 06/16] nbd: do not block on partial reply header reads

2017-01-13 Thread Paolo Bonzini
Read the replies from a coroutine, switching the read side between the "read header" coroutine and the I/O coroutine that reads the body of the reply. qio_channel_yield is used so that the right coroutine is restarted automatically, eliminating the need for send_coroutine in NBDClientSession. Sig