From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqQ4p-00068s-Jc for qemu-devel@nongnu.org; Mon, 17 Nov 2014 12:27:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqQ4i-0004ym-K9 for qemu-devel@nongnu.org; Mon, 17 Nov 2014 12:26:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqQ4i-0004yS-DY for qemu-devel@nongnu.org; Mon, 17 Nov 2014 12:26:52 -0500 Message-ID: <546A2FD0.3090907@redhat.com> Date: Mon, 17 Nov 2014 18:26:40 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1416238250-414-1-git-send-email-mreitz@redhat.com> <1416238250-414-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1416238250-414-3-git-send-email-mreitz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/5] block: Add AioContextNotifier functions to BB List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , Markus Armbruster , Stefan Hajnoczi On 17/11/2014 16:30, Max Reitz wrote: > Because all BlockDriverStates behind a single BlockBackend reside in a > single AioContext, it is fine to just pass these functions > (blk_add_aio_context_notifier() and blk_remove_aio_context_notifier()) > through to the root BlockDriverState. > > Signed-off-by: Max Reitz The logical question then is: are there any function in BlockDriverState that do not make sense as a BlockBackend API? Paolo > --- > block/block-backend.c | 18 ++++++++++++++++++ > include/sysemu/block-backend.h | 8 ++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/block/block-backend.c b/block/block-backend.c > index 89f69b7..7a7f690 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -624,6 +624,24 @@ void blk_set_aio_context(BlockBackend *blk, AioContext *new_context) > bdrv_set_aio_context(blk->bs, new_context); > } > > +void blk_add_aio_context_notifier(BlockBackend *blk, > + void (*attached_aio_context)(AioContext *new_context, void *opaque), > + void (*detach_aio_context)(void *opaque), void *opaque) > +{ > + bdrv_add_aio_context_notifier(blk->bs, attached_aio_context, > + detach_aio_context, opaque); > +} > + > +void blk_remove_aio_context_notifier(BlockBackend *blk, > + void (*attached_aio_context)(AioContext *, > + void *), > + void (*detach_aio_context)(void *), > + void *opaque) > +{ > + bdrv_remove_aio_context_notifier(blk->bs, attached_aio_context, > + detach_aio_context, opaque); > +} > + > void blk_io_plug(BlockBackend *blk) > { > bdrv_io_plug(blk->bs); > diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h > index 0c46b82..d9c1337 100644 > --- a/include/sysemu/block-backend.h > +++ b/include/sysemu/block-backend.h > @@ -135,6 +135,14 @@ void blk_op_block_all(BlockBackend *blk, Error *reason); > void blk_op_unblock_all(BlockBackend *blk, Error *reason); > AioContext *blk_get_aio_context(BlockBackend *blk); > void blk_set_aio_context(BlockBackend *blk, AioContext *new_context); > +void blk_add_aio_context_notifier(BlockBackend *blk, > + void (*attached_aio_context)(AioContext *new_context, void *opaque), > + void (*detach_aio_context)(void *opaque), void *opaque); > +void blk_remove_aio_context_notifier(BlockBackend *blk, > + void (*attached_aio_context)(AioContext *, > + void *), > + void (*detach_aio_context)(void *), > + void *opaque); > void blk_io_plug(BlockBackend *blk); > void blk_io_unplug(BlockBackend *blk); > BlockAcctStats *blk_get_stats(BlockBackend *blk); >