[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v3 18/19] block: Use a single global AioWait
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v3 18/19] block: Use a single global AioWait |
Date: |
Mon, 24 Sep 2018 19:09:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 20.09.18 18:19, Kevin Wolf wrote:
> When draining a block node, we recurse to its parent and for subtree
> drains also to its children. A single AIO_WAIT_WHILE() is then used to
> wait for bdrv_drain_poll() to become true, which depends on all of the
> nodes we recursed to. However, if the respective child or parent becomes
> quiescent and calls bdrv_wakeup(), only the AioWait of the child/parent
> is checked, while AIO_WAIT_WHILE() depends on the AioWait of the
> original node.
>
> Fix this by using a single AioWait for all callers of AIO_WAIT_WHILE().
>
> This may mean that the draining thread gets a few more unnecessary
> wakeups because an unrelated operation got completed, but we already
> wake it up when something _could_ have changed rather than only if it
> has certainly changed.
>
> Apart from that, drain is a slow path anyway. In theory it would be
> possible to use wakeups more selectively and still correctly, but the
> gains are likely not worth the additional complexity. In fact, this
> patch is a nice simplification for some places in the code.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> include/block/aio-wait.h | 11 +++++------
> include/block/block.h | 6 +-----
> include/block/block_int.h | 3 ---
> include/block/blockjob.h | 10 ----------
> block.c | 5 -----
> block/block-backend.c | 11 ++++-------
> block/io.c | 7 ++-----
> blockjob.c | 13 +------------
> job.c | 3 +--
> util/aio-wait.c | 11 ++++++-----
> 10 files changed, 20 insertions(+), 60 deletions(-)
Reviewed-by: Max Reitz <address@hidden>
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v3 16/19] test-bdrv-drain: AIO_WAIT_WHILE() in job .commit/.abort, (continued)
- [Qemu-block] [PATCH v3 16/19] test-bdrv-drain: AIO_WAIT_WHILE() in job .commit/.abort, Kevin Wolf, 2018/09/20
- [Qemu-block] [PATCH v3 15/19] job: Avoid deadlocks in job_completed_txn_abort(), Kevin Wolf, 2018/09/20
- [Qemu-block] [PATCH v3 17/19] test-bdrv-drain: Fix outdated comments, Kevin Wolf, 2018/09/20
- [Qemu-block] [PATCH v3 19/19] test-bdrv-drain: Test draining job source child and parent, Kevin Wolf, 2018/09/20
- [Qemu-block] [PATCH v3 18/19] block: Use a single global AioWait, Kevin Wolf, 2018/09/20