From: Paolo Bonzini <pbonzini@redhat.com>
To: Josh Durgin <josh.durgin@inktank.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v3 18/25] rbd: use BlockDriverState's AioContext
Date: Fri, 09 May 2014 10:16:07 +0200 [thread overview]
Message-ID: <536C8EC7.4090004@redhat.com> (raw)
In-Reply-To: <536C1B80.6090202@inktank.com>
Il 09/05/2014 02:04, Josh Durgin ha scritto:
> 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 <josh.durgin@inktank.com>
>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>> ---
>> 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 <josh.durgin@inktank.com>
bdrv_get_aio_context()/bdrv_set_aio_context() are safe if called from
the AioContext's own iothread. This is the case here, in fact
aio_bh_new has the same requirement (qemu_bh_schedule instead does not).
Paolo
next prev parent reply other threads:[~2014-05-09 8:16 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 14:34 [Qemu-devel] [PATCH v3 00/25] dataplane: use QEMU block layer Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 01/25] block: use BlockDriverState AioContext Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 02/25] block: acquire AioContext in bdrv_*_all() Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 03/25] block: acquire AioContext in bdrv_drain_all() Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 04/25] block: add bdrv_set_aio_context() Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 05/25] blkdebug: use BlockDriverState's AioContext Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 06/25] blkverify: implement .bdrv_detach/attach_aio_context() Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 07/25] curl: " Stefan Hajnoczi
2014-05-13 2:06 ` Fam Zheng
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 08/25] gluster: use BlockDriverState's AioContext Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 09/25] iscsi: implement .bdrv_detach/attach_aio_context() Stefan Hajnoczi
2014-05-08 15:47 ` Peter Lieven
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 10/25] nbd: " Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 11/25] nfs: " Stefan Hajnoczi
2014-05-08 15:46 ` Peter Lieven
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 12/25] qed: use BlockDriverState's AioContext Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 13/25] quorum: implement .bdrv_detach/attach_aio_context() Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 14/25] block/raw-posix: " Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 15/25] block/linux-aio: fix memory and fd leak Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 16/25] block/raw-win32: create one QEMUWin32AIOState per BDRVRawState Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 17/25] block/raw-win32: implement .bdrv_detach/attach_aio_context() Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 18/25] rbd: use BlockDriverState's AioContext Stefan Hajnoczi
2014-05-09 0:04 ` Josh Durgin
2014-05-09 8:16 ` Paolo Bonzini [this message]
2014-05-09 8:22 ` Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 19/25] sheepdog: implement .bdrv_detach/attach_aio_context() Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 20/25] ssh: use BlockDriverState's AioContext Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 21/25] vmdk: implement .bdrv_detach/attach_aio_context() Stefan Hajnoczi
2014-05-15 1:34 ` Fam Zheng
2014-05-15 7:33 ` Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 22/25] dataplane: use the QEMU block layer for I/O Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 23/25] dataplane: delete IOQueue since it is no longer used Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 24/25] dataplane: implement async flush Stefan Hajnoczi
2014-05-08 14:34 ` [Qemu-devel] [PATCH v3 25/25] raw-posix: drop raw_get_aio_fd() since it is no longer used Stefan Hajnoczi
2014-06-03 13:33 ` [Qemu-devel] [PATCH v3 00/25] dataplane: use QEMU block layer 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=536C8EC7.4090004@redhat.com \
--to=pbonzini@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=josh.durgin@inktank.com \
--cc=kwolf@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).