Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-09 Thread Stefan Hajnoczi
On Sat, Jun 07, 2014 at 09:27:26PM +0200, Max Reitz wrote: On 06.06.2014 09:44, Paolo Bonzini wrote: Il 05/06/2014 20:18, Max Reitz ha scritto: Why is this design cleaner? Because NBD code doesn't have to worry about fd handlers. It uses straightforward coroutine send/recv for socket I/O

Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-07 Thread Max Reitz
On 06.06.2014 09:44, Paolo Bonzini wrote: Il 05/06/2014 20:18, Max Reitz ha scritto: Why is this design cleaner? Because NBD code doesn't have to worry about fd handlers. It uses straightforward coroutine send/recv for socket I/O inside nbd_read_req() and nbd_write_resp(). It's easy to see

Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-06 Thread Paolo Bonzini
Il 05/06/2014 20:18, Max Reitz ha scritto: Why is this design cleaner? Because NBD code doesn't have to worry about fd handlers. It uses straightforward coroutine send/recv for socket I/O inside nbd_read_req() and nbd_write_resp(). It's easy to see that only one coroutine receives from the

Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-05 Thread Stefan Hajnoczi
On Wed, Jun 04, 2014 at 08:02:06PM +0200, Paolo Bonzini wrote: Il 04/06/2014 14:37, Stefan Hajnoczi ha scritto: Why is this design cleaner? Because NBD code doesn't have to worry about fd handlers. It uses straightforward coroutine send/recv for socket I/O inside nbd_read_req() and

Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-05 Thread Paolo Bonzini
Il 05/06/2014 10:12, Stefan Hajnoczi ha scritto: On Wed, Jun 04, 2014 at 08:02:06PM +0200, Paolo Bonzini wrote: Il 04/06/2014 14:37, Stefan Hajnoczi ha scritto: Why is this design cleaner? Because NBD code doesn't have to worry about fd handlers. It uses straightforward coroutine send/recv

Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-05 Thread Stefan Hajnoczi
On Thu, Jun 05, 2014 at 11:27:49AM +0200, Paolo Bonzini wrote: Il 05/06/2014 10:12, Stefan Hajnoczi ha scritto: On Wed, Jun 04, 2014 at 08:02:06PM +0200, Paolo Bonzini wrote: Il 04/06/2014 14:37, Stefan Hajnoczi ha scritto: Why is this design cleaner? Because NBD code doesn't have to worry

Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-05 Thread Max Reitz
On 04.06.2014 14:37, Stefan Hajnoczi wrote: On Sat, May 31, 2014 at 08:43:10PM +0200, Max Reitz wrote: Instead of using the main loop function qemu_set_fd_handler2(), use the AIO function in the context of the exported BDS. Managing fd handlers shouldn't be necessary at the NBD code level.

Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-04 Thread Stefan Hajnoczi
On Sat, May 31, 2014 at 08:43:10PM +0200, Max Reitz wrote: Instead of using the main loop function qemu_set_fd_handler2(), use the AIO function in the context of the exported BDS. Managing fd handlers shouldn't be necessary at the NBD code level. The current NBD code hasn't been fully

Re: [Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-06-04 Thread Paolo Bonzini
Il 04/06/2014 14:37, Stefan Hajnoczi ha scritto: Why is this design cleaner? Because NBD code doesn't have to worry about fd handlers. It uses straightforward coroutine send/recv for socket I/O inside nbd_read_req() and nbd_write_resp(). It's easy to see that only one coroutine receives from

[Qemu-devel] [RFC 3/5] nbd: Use aio_set_fd_handler2()

2014-05-31 Thread Max Reitz
Instead of using the main loop function qemu_set_fd_handler2(), use the AIO function in the context of the exported BDS. Signed-off-by: Max Reitz mre...@redhat.com --- nbd.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/nbd.c b/nbd.c index