From: Paolo Bonzini <pbonzini@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Peter Lieven <pl@kamp.de>,
Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/5] block: Add AioContextNotifier functions to BB
Date: Mon, 17 Nov 2014 18:26:40 +0100 [thread overview]
Message-ID: <546A2FD0.3090907@redhat.com> (raw)
In-Reply-To: <1416238250-414-3-git-send-email-mreitz@redhat.com>
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 <mreitz@redhat.com>
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);
>
next prev parent reply other threads:[~2014-11-17 17:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-17 15:30 [Qemu-devel] [PATCH 0/5] nbd: Use BlockBackend Max Reitz
2014-11-17 15:30 ` [Qemu-devel] [PATCH 1/5] block: Lift more functions into BlockBackend Max Reitz
2014-11-17 15:30 ` [Qemu-devel] [PATCH 2/5] block: Add AioContextNotifier functions to BB Max Reitz
2014-11-17 17:26 ` Paolo Bonzini [this message]
2014-11-18 9:26 ` Max Reitz
2014-11-18 9:44 ` Paolo Bonzini
2014-11-17 15:30 ` [Qemu-devel] [PATCH 3/5] block: Add blk_add_close_notifier() for BB Max Reitz
2014-11-17 15:30 ` [Qemu-devel] [PATCH 4/5] nbd: Change external interface to BlockBackend Max Reitz
2014-11-17 15:30 ` [Qemu-devel] [PATCH 5/5] nbd: Use BlockBackend internally Max Reitz
2014-11-17 17:29 ` Paolo Bonzini
2014-11-18 9:32 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=546A2FD0.3090907@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).