From: Fam Zheng <famz@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] dma-helpers: dma_blk_io() cancel support
Date: Tue, 21 Jun 2016 09:25:51 +0800 [thread overview]
Message-ID: <20160621012551.GA22440@ad.usersys.redhat.com> (raw)
In-Reply-To: <1466451417-27988-1-git-send-email-stefanha@redhat.com>
On Mon, 06/20 20:36, Stefan Hajnoczi wrote:
> Attempting to cancel a dma_blk_io() request causes an abort(3):
>
> void bdrv_aio_cancel(BlockAIOCB *acb)
> {
> ...
> while (acb->refcnt > 1) {
> if (acb->aiocb_info->get_aio_context) {
> aio_poll(acb->aiocb_info->get_aio_context(acb), true);
> } else if (acb->bs) {
> aio_poll(bdrv_get_aio_context(acb->bs), true);
> } else {
> abort();
> }
> }
> ...
> }
>
> This happens because DMAAIOCB->bs is NULL and
> dma_aiocb_info.get_aio_context() is also NULL.
>
> This patch trivially implements dma_aiocb_info.get_aio_context() by
> fetching the DMAAIOCB->ctx field.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> dma-helpers.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/dma-helpers.c b/dma-helpers.c
> index b521d84..9defc10 100644
> --- a/dma-helpers.c
> +++ b/dma-helpers.c
> @@ -185,10 +185,17 @@ static void dma_aio_cancel(BlockAIOCB *acb)
> }
> }
>
> +static AioContext *dma_get_aio_context(BlockAIOCB *acb)
> +{
> + DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);
> +
> + return dbs->ctx;
> +}
>
> static const AIOCBInfo dma_aiocb_info = {
> .aiocb_size = sizeof(DMAAIOCB),
> .cancel_async = dma_aio_cancel,
> + .get_aio_context = dma_get_aio_context,
> };
>
> BlockAIOCB *dma_blk_io(AioContext *ctx,
> --
> 2.5.5
>
>
Reviewed-by: Fam Zheng <famz@redhat.com>
next prev parent reply other threads:[~2016-06-21 1:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 19:36 [Qemu-devel] [PATCH] dma-helpers: dma_blk_io() cancel support Stefan Hajnoczi
2016-06-21 1:25 ` Fam Zheng [this message]
2016-06-22 12:17 ` Stefan Hajnoczi
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=20160621012551.GA22440@ad.usersys.redhat.com \
--to=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--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).