block: Simplify drain
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest15 patches 15 repliesIn review
- v113 patches 47 repliesSuperseded
Changes in v2 from the cover letter
- Rebased on master
- Patch 3: Removed left over _co parts in function names
- Patch 4: Updated function comments to reflect that we're not polling any more
- Patch 6 (new): Fix inconsistent AioContext locking for reopen code
- Patch 9 (was 8): Added comment to clarify when polling is allowed and the graph may change again
- Patch 11 (was 10):
* Reworded some comments and the commit message.
* Dropped a now unnecessary assertion that was dropped only in a later patch in v1 of the series.
* Changed 'int parent_quiesce_counter' into 'bool quiesced_parent'
- Patch 12 (was 11): Don't remove ignore_bds_parents from bdrv_drain_poll(), it is actually still a valid optimisation there that makes polling O(n) instead of O(n²)
- Patch 13 (new): Instead of only removing assert(!qemu_in_coroutine()) like in v1 of the series, drop out of coroutine context in bdrv_do_drained_begin_quiesce() just to be sure that we'll never get coroutine surprises in drain code.
- Patch 14 (was 12): More and reworded comments to make things hopefully a bit clearer
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/15 | qed: Don't yield in bdrv_qed_co_drain_begin()block/ | +17 | 0 replies | |
| 2/15 | test-bdrv-drain: Don't yield in .bdrv_co_drained_begin/end()tests/ | +46 | 0 replies | |
| 3/15 | block: Revert .bdrv_drained_begin/end to non-coroutine_fnblock.c block/ block/ +3 more | +32 | 0 replies | |
| 4/15 | block: Remove drained_end_counterblock.c block/ block/ +3 more | +30 | 0 replies | |
| 5/15 | block: Inline bdrv_drain_invoke()block/ | +6 | 0 replies | |
| 6/15 | block: Fix locking for bdrv_reopen_queue_child()block.c | +5 | 1 reply | |
| 7/15 | block: Drain invidual nodes during reopenblock.c block/ blockdev.c | +9 | 1 reply | |
| 8/15 | block: Don't use subtree drains in bdrv_drop_intermediate()block.c | +2 | 0 replies | |
| 9/15 | stream: Replace subtree drain with a single node drainblock.c block/ include/ | +33 | 0 replies | |
| 10/15 | block: Remove subtree drainsblock.c block/ include/ +3 more | +44 | 0 replies | |
| 11/15 | block: Call drain callbacks only onceblock.c block/ include/ +1 more | +39 | 2 replies | |
| 12/15 | block: Remove ignore_bds_parents parameter from drain_begin/end.block.c block/ include/ | +24 | 1 reply | |
| 13/15 | block: Drop out of coroutine in bdrv_do_drained_begin_quiesce()block/ | +12 | 1 reply | |
| 14/15 | block: Don't poll in bdrv_replace_child_noperm()block.c block/ include/ +1 more | +108 | 6 replies | |
| 15/15 | block: Remove poll parameter from bdrv_parent_drained_begin_single()block.c block/ include/ | +6 | 1 reply |
Reviews trailers per patch
All 15 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Vladimir Sementsov-Ogievskiy | Hanna Reitz | Stefan Hajnoczi | Emanuele Giuseppe Esposito |
|---|---|---|---|---|
| Series | R-b | |||
| 1/15 | R-b | R-b | R-b | |
| 2/15 | R-b | R-b | R-b | |
| 3/15 | R-b | R-b | R-b | |
| 4/15 | R-b | R-b | ||
| 5/15 | R-b | R-b | R-b | R-b |
| 6/15 | R-b | |||
| 7/15 | R-b | |||
| 8/15 | R-b | R-b | ||
| 9/15 | R-b | R-b | ||
| 10/15 | R-b | R-b | ||
| 11/15 | R-b | R-b | ||
| 12/15 | R-b | |||
| 13/15 | R-b | |||
| 14/15 | R-b | |||
| 15/15 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH v2 00/15] block: Simplify drain
I'm aware that exactly nobody has been looking forward to a series with this title, but it has to be. The way drain works means that we need to poll in bdrv_replace_child_noperm() and that makes things rather messy with Emanuele's multiqueue work because you must not poll while you hold the graph lock.
The other reason why it has to be is that drain is way too complex and there are too many different cases. Some simplification like this will hopefully make it considerably more maintainable. The diffstat probably tells something, too.
There are roughly speaking three parts in this series:
1. Make BlockDriver.bdrv_drained_begin/end() non-coroutine_fn again, which allows us to not poll on bdrv_drained_end() any more.
2. Remove subtree drains. They are a considerable complication in the whole drain machinery (in particular, they require polling in the BdrvChildClass.attach/detach() callbacks that are called during bdrv_replace_child_noperm()) and none of their users actually has a good reason to use them.
3. Finally get rid of polling in bdrv_replace_child_noperm() by requiring that the child is already drained by the caller and calling callbacks only once and not again for every nested drain section.
If necessary, a prefix of this series can be merged that covers only the first or the first two parts and it would still make sense.
v2:
- Rebased on master
- Patch 3: Removed left over _co parts in function names
- Patch 4: Updated function comments to reflect that we're not polling any more
- Patch 6 (new): Fix inconsistent AioContext locking for reopen code
- Patch 9 (was 8): Added comment to clarify when polling is allowed and the graph may change again
- Patch 11 (was 10):
* Reworded some comments and the commit message.
* Dropped a now unnecessary assertion that was dropped only in a later patch in v1 of the series.
* Changed 'int parent_quiesce_counter' into 'bool quiesced_parent'
- Patch 12 (was 11): Don't remove ignore_bds_parents from bdrv_drain_poll(), it is actually still a valid optimisation there that makes polling O(n) instead of O(n²)
- Patch 13 (new): Instead of only removing assert(!qemu_in_coroutine()) like in v1 of the series, drop out of coroutine context in bdrv_do_drained_begin_quiesce() just to be sure that we'll never get coroutine surprises in drain code.
- Patch 14 (was 12): More and reworded comments to make things hopefully a bit clearer
Kevin Wolf (15):
qed: Don't yield in bdrv_qed_co_drain_begin()
test-bdrv-drain: Don't yield in .bdrv_co_drained_begin/end()
block: Revert .bdrv_drained_begin/end to non-coroutine_fn
block: Remove drained_end_counter
block: Inline bdrv_drain_invoke()
block: Fix locking for bdrv_reopen_queue_child()
block: Drain invidual nodes during reopen
block: Don't use subtree drains in bdrv_drop_intermediate()
stream: Replace subtree drain with a single node drain
block: Remove subtree drains
block: Call drain callbacks only once
block: Remove ignore_bds_parents parameter from drain_begin/end.
block: Drop out of coroutine in bdrv_do_drained_begin_quiesce()
block: Don't poll in bdrv_replace_child_noperm()
block: Remove poll parameter from bdrv_parent_drained_begin_single()
include/block/block-global-state.h | 3 + include/block/block-io.h | 58 ++--- include/block/block_int-common.h | 25 +- include/block/block_int-io.h | 12 - block.c | 185 ++++++++++----- block/block-backend.c | 4 +- block/io.c | 290 +++++------------------ block/qed.c | 26 +- block/replication.c | 6 - block/stream.c | 26 +- block/throttle.c | 8 +- blockdev.c | 13 - blockjob.c | 2 +- tests/unit/test-bdrv-drain.c | 369 +++++++---------------------- 14 files changed, 340 insertions(+), 687 deletions(-)
Signature · 1 line
2.38.1