qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 2/8] block: Add bdrv_aio_cancel_async
Date: Tue, 2 Sep 2014 11:55:29 +0100	[thread overview]
Message-ID: <20140902105529.GJ29067@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1409107756-5967-3-git-send-email-famz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

On Wed, Aug 27, 2014 at 10:49:10AM +0800, Fam Zheng wrote:
> +/* Async version of aio cancel. The caller is not blocked if the acb implements
> + * cancel_async, otherwise fall back to bdrv_aio_cancel. In both cases, acb->cb
> + * is guarenteed to be called, before or after function returns. */
> +void bdrv_aio_cancel_async(BlockDriverAIOCB *acb)
> +{
> +    if (acb->aiocb_info->cancel_async) {
> +        acb->aiocb_info->cancel_async(acb);
> +    } else {
> +        /* Mask the cb and cancel, we'll call it manually once the synchronous
> +         * cancel is done. */
> +        BlockDriverCompletionFunc *cb = acb->cb;
> +        void *opaque = acb->opaque;
> +        acb->cb = bdrv_aio_cancel_cb_nop;
> +        acb->opaque = NULL;
> +        qemu_aio_ref(acb);
> +        acb->aiocb_info->cancel(acb);
> +        cb(opaque, -ECANCELED);
> +        qemu_aio_release(acb);
> +    }
> +}

It is not totally obvious why we hijack the callback.  If you respin,
please rephrase the comment along the lines of:

/* bdrv_aio_cancel() does not guarantee to invoke cb() so mask it during
 * bdrv_aio_cancel() and always invoke it ourselves.
 */

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-09-02 10:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27  2:49 [Qemu-devel] [PATCH v3 0/8] block: Asynchronous request cancellation Fam Zheng
2014-08-27  2:49 ` [Qemu-devel] [PATCH v3 1/8] block: Add refcnt in BlockDriverAIOCB Fam Zheng
2014-08-27  2:49 ` [Qemu-devel] [PATCH v3 2/8] block: Add bdrv_aio_cancel_async Fam Zheng
2014-09-02 10:55   ` Stefan Hajnoczi [this message]
2014-08-27  2:49 ` [Qemu-devel] [PATCH v3 3/8] tests: Add testing code for bdrv_aio_cancel_async Fam Zheng
2014-08-27  2:49 ` [Qemu-devel] [PATCH v3 4/8] linux-aio: Implement .cancel_async Fam Zheng
2014-09-02 14:55   ` Stefan Hajnoczi
2014-08-27  2:49 ` [Qemu-devel] [PATCH v3 5/8] thread-pool: " Fam Zheng
2014-08-27  2:49 ` [Qemu-devel] [PATCH v3 6/8] dma: " Fam Zheng
2014-08-27  2:49 ` [Qemu-devel] [PATCH v3 7/8] block: Implement bdrv_em_co_aiocb_info.cancel_async Fam Zheng
2014-08-27  2:49 ` [Qemu-devel] [PATCH v3 8/8] iscsi: Implement .cancel_async in acb info Fam Zheng
2014-09-02 15:09 ` [Qemu-devel] [PATCH v3 0/8] block: Asynchronous request cancellation Stefan Hajnoczi
2014-09-03  0:35   ` Fam Zheng

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=20140902105529.GJ29067@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).