From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiOeu-0000VS-1Z for qemu-devel@nongnu.org; Thu, 08 May 2014 09:46:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiOem-0001qh-FH for qemu-devel@nongnu.org; Thu, 08 May 2014 09:46:47 -0400 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:32949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiOem-0001qY-6c for qemu-devel@nongnu.org; Thu, 08 May 2014 09:46:40 -0400 Received: by mail-wg0-f41.google.com with SMTP id z12so2541222wgg.12 for ; Thu, 08 May 2014 06:46:39 -0700 (PDT) Date: Thu, 8 May 2014 15:46:36 +0200 From: Stefan Hajnoczi Message-ID: <20140508134636.GC13226@stefanha-thinkpad.redhat.com> References: <1399458461-3997-1-git-send-email-stefanha@redhat.com> <1399458461-3997-12-git-send-email-stefanha@redhat.com> <536A3F3C.40300@kamp.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <536A3F3C.40300@kamp.de> Subject: Re: [Qemu-devel] [PATCH v2 11/25] nfs: implement .bdrv_detach/attach_aio_context() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org, Stefan Hajnoczi 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 > >Signed-off-by: Stefan Hajnoczi > >--- > > 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