Re: [Qemu-devel] [PATCH v2 1/4] block: extract AIO_WAIT_WHILE() from BlockDriverState

2018-02-15 Thread Eric Blake
On 02/15/2018 04:12 AM, Kevin Wolf wrote: Having acquired the AioContext does not make this function return true. The semantics are: 1. Current thread is the IOThread that runs the AioContext 2. Current thread is the main loop and the AioContext is the global AioContext. The function tests

Re: [Qemu-devel] [PATCH v2 1/4] block: extract AIO_WAIT_WHILE() from BlockDriverState

2018-02-15 Thread Kevin Wolf
Am 15.02.2018 um 10:27 hat Stefan Hajnoczi geschrieben: > On Wed, Feb 14, 2018 at 04:31:45PM -0600, Eric Blake wrote: > > On 02/14/2018 08:06 AM, Stefan Hajnoczi wrote: > > > On Tue, Feb 13, 2018 at 10:01:06AM -0600, Eric Blake wrote: > > > I hope this explains things! The main issue that raised

Re: [Qemu-devel] [PATCH v2 1/4] block: extract AIO_WAIT_WHILE() from BlockDriverState

2018-02-15 Thread Stefan Hajnoczi
On Wed, Feb 14, 2018 at 04:31:45PM -0600, Eric Blake wrote: > On 02/14/2018 08:06 AM, Stefan Hajnoczi wrote: > > On Tue, Feb 13, 2018 at 10:01:06AM -0600, Eric Blake wrote: > > I hope this explains things! The main issue that raised these questions > > was that aio_context_in_iothread() has a

Re: [Qemu-devel] [PATCH v2 1/4] block: extract AIO_WAIT_WHILE() from BlockDriverState

2018-02-14 Thread Eric Blake
On 02/13/2018 10:01 AM, Eric Blake wrote: On 02/13/2018 08:20 AM, Stefan Hajnoczi wrote: BlockDriverState has the BDRV_POLL_WHILE() macro to wait on event loop activity while a condition evaluates to true.  This is used to implement synchronous operations where it acts as a condvar between the

Re: [Qemu-devel] [PATCH v2 1/4] block: extract AIO_WAIT_WHILE() from BlockDriverState

2018-02-14 Thread Eric Blake
On 02/14/2018 08:06 AM, Stefan Hajnoczi wrote: On Tue, Feb 13, 2018 at 10:01:06AM -0600, Eric Blake wrote: Trying to understand here: +#define AIO_WAIT_WHILE(wait, ctx, cond) ({ \ +bool waited_ = false; \ +bool busy_ = true;

Re: [Qemu-devel] [PATCH v2 1/4] block: extract AIO_WAIT_WHILE() from BlockDriverState

2018-02-14 Thread Stefan Hajnoczi
On Tue, Feb 13, 2018 at 10:01:06AM -0600, Eric Blake wrote: > Trying to understand here: > > > > +#define AIO_WAIT_WHILE(wait, ctx, cond) ({ \ > > +bool waited_ = false; \ > > +bool busy_ = true; \ >

Re: [Qemu-devel] [PATCH v2 1/4] block: extract AIO_WAIT_WHILE() from BlockDriverState

2018-02-13 Thread Eric Blake
On 02/13/2018 08:20 AM, Stefan Hajnoczi wrote: BlockDriverState has the BDRV_POLL_WHILE() macro to wait on event loop activity while a condition evaluates to true. This is used to implement synchronous operations where it acts as a condvar between the IOThread running the operation and the main

[Qemu-devel] [PATCH v2 1/4] block: extract AIO_WAIT_WHILE() from BlockDriverState

2018-02-13 Thread Stefan Hajnoczi
BlockDriverState has the BDRV_POLL_WHILE() macro to wait on event loop activity while a condition evaluates to true. This is used to implement synchronous operations where it acts as a condvar between the IOThread running the operation and the main loop waiting for the operation. It can also be