On Wed, May 07, 2014 at 04:12:12PM +0200, Peter Lieven wrote:
> On 07.05.2014 12:27, Stefan Hajnoczi wrote:
> >Drop the assumption that we're using the main AioContext. The following
> >functions need to be converted:
> > * qemu_bh_new() -> aio_bh_new()
> > * qemu_aio_set_fd_handler() -> aio_set_fd_handler()
> > * qemu_aio_wait() -> aio_poll()
> >
> >The .bdrv_detach/attach_aio_context() interfaces also need to be
> >implemented to move the fd handler from the old to the new AioContext.
> >
> >Cc: Peter Lieven <[email protected]>
> >Signed-off-by: Stefan Hajnoczi <[email protected]>
> >---
> > block/nfs.c | 80
> > ++++++++++++++++++++++++++++++++++++++++++-------------------
> > 1 file changed, 56 insertions(+), 24 deletions(-)
> >
> >diff --git a/block/nfs.c b/block/nfs.c
> >index 9fa831f..33f198b 100644
> >--- a/block/nfs.c
> >+++ b/block/nfs.c
> >@@ -40,6 +40,7 @@ typedef struct NFSClient {
> > struct nfsfh *fh;
> > int events;
> > bool has_zero_init;
> >+ AioContext *aio_context;
> > } NFSClient;
> > typedef struct NFSRPC {
> >@@ -49,6 +50,7 @@ typedef struct NFSRPC {
> > struct stat *st;
> > Coroutine *co;
> > QEMUBH *bh;
> >+ AioContext *aio_context;
> > } NFSRPC;
>
> If you need to respin for some reason, I would copy the pointer
> to the whole NFSClient struct here just in case we need any other
> member of that struct in the future.
Fixed in v3.
> >@@ -403,7 +432,7 @@ static int64_t
> >nfs_get_allocated_file_size(BlockDriverState *bs)
> > while (!task.complete) {
> > nfs_set_events(client);
> >- qemu_aio_wait();
> >+ aio_poll(bdrv_get_aio_context(bs), true);
> > }
>
> Why not
>
> aio_poll(client->aio_context, true);
>
> ?
Fixed in v3.
Stefan