From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wig4a-0007YI-CC for qemu-devel@nongnu.org; Fri, 09 May 2014 04:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wig4U-0002aF-0V for qemu-devel@nongnu.org; Fri, 09 May 2014 04:22:28 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:57377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wig4T-0002a8-QL for qemu-devel@nongnu.org; Fri, 09 May 2014 04:22:21 -0400 Received: by mail-wi0-f172.google.com with SMTP id hi2so929248wib.11 for ; Fri, 09 May 2014 01:22:21 -0700 (PDT) Date: Fri, 9 May 2014 10:22:18 +0200 From: Stefan Hajnoczi Message-ID: <20140509082218.GC12865@stefanha-thinkpad.redhat.com> References: <1399559698-31900-1-git-send-email-stefanha@redhat.com> <1399559698-31900-19-git-send-email-stefanha@redhat.com> <536C1B80.6090202@inktank.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <536C1B80.6090202@inktank.com> Subject: Re: [Qemu-devel] [PATCH v3 18/25] rbd: use BlockDriverState's AioContext List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Josh Durgin Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org, Stefan Hajnoczi , Christian Borntraeger On Thu, May 08, 2014 at 05:04:16PM -0700, Josh Durgin wrote: > On 05/08/2014 07:34 AM, Stefan Hajnoczi wrote: > >Drop the assumption that we're using the main AioContext. Convert > >qemu_bh_new() to aio_bh_new() and qemu_aio_wait() to aio_poll(). > > > >The .bdrv_detach_aio_context() and .bdrv_attach_aio_context() interfaces > >are not needed since no fd handlers, timers, or BHs stay registered when > >requests have been drained. > > > >Cc: Josh Durgin > >Signed-off-by: Stefan Hajnoczi > >--- > > block/rbd.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > >diff --git a/block/rbd.c b/block/rbd.c > >index dbc79f4..41f7bdc 100644 > >--- a/block/rbd.c > >+++ b/block/rbd.c > >@@ -548,7 +548,7 @@ static void qemu_rbd_aio_cancel(BlockDriverAIOCB *blockacb) > > acb->cancelled = 1; > > > > while (acb->status == -EINPROGRESS) { > >- qemu_aio_wait(); > >+ aio_poll(bdrv_get_aio_context(acb->common.bs), true); > > } > > > > qemu_aio_release(acb); > >@@ -581,7 +581,8 @@ static void rbd_finish_aiocb(rbd_completion_t c, RADOSCB *rcb) > > rcb->ret = rbd_aio_get_return_value(c); > > rbd_aio_release(c); > > > >- acb->bh = qemu_bh_new(rbd_finish_bh, rcb); > >+ acb->bh = aio_bh_new(bdrv_get_aio_context(acb->common.bs), > >+ rbd_finish_bh, rcb); > > qemu_bh_schedule(acb->bh); > > } > > Assuming bdrv_get_aio_context() continues to be safe to call from a > non-qemu thread: > > Reviewed-by: Josh Durgin Yes, we're running in the AioContext associated with this BlockDriverState. This effectively means we have a lock on the BlockDriverState.