qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 11/25] nfs: implement .bdrv_detach/attach_aio


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2 11/25] nfs: implement .bdrv_detach/attach_aio_context()
Date: Thu, 8 May 2014 15:46:36 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
> >Signed-off-by: Stefan Hajnoczi <address@hidden>
> >---
> >  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]