[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 09/13] block: Loop unsafely in bdrv*drained_end()
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 09/13] block: Loop unsafely in bdrv*drained_end() |
Date: |
Fri, 19 Jul 2019 15:43:41 +0200 |
From: Max Reitz <address@hidden>
The graph must not change in these loops (or a QLIST_FOREACH_SAFE would
not even be enough). We now ensure this by only polling once in the
root bdrv_drained_end() call, so we can drop the _SAFE suffix. Doing so
makes it clear that the graph must not change.
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/io.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/io.c b/block/io.c
index 8f23cab82e..b89e155d21 100644
--- a/block/io.c
+++ b/block/io.c
@@ -76,9 +76,9 @@ static void bdrv_parent_drained_end(BlockDriverState *bs,
BdrvChild *ignore,
bool ignore_bds_parents,
int *drained_end_counter)
{
- BdrvChild *c, *next;
+ BdrvChild *c;
- QLIST_FOREACH_SAFE(c, &bs->parents, next_parent, next) {
+ QLIST_FOREACH(c, &bs->parents, next_parent) {
if (c == ignore || (ignore_bds_parents && c->role->parent_is_bds)) {
continue;
}
@@ -456,7 +456,7 @@ static void bdrv_do_drained_end(BlockDriverState *bs, bool
recursive,
BdrvChild *parent, bool ignore_bds_parents,
int *drained_end_counter)
{
- BdrvChild *child, *next;
+ BdrvChild *child;
int old_quiesce_counter;
assert(drained_end_counter != NULL);
@@ -481,7 +481,7 @@ static void bdrv_do_drained_end(BlockDriverState *bs, bool
recursive,
if (recursive) {
assert(!ignore_bds_parents);
bs->recursive_quiesce_counter--;
- QLIST_FOREACH_SAFE(child, &bs->children, next, next) {
+ QLIST_FOREACH(child, &bs->children, next) {
bdrv_do_drained_end(child->bs, true, child, ignore_bds_parents,
drained_end_counter);
}
--
2.20.1
[Qemu-block] [PULL 05/13] block: Make bdrv_parent_drained_[^_]*() static, Kevin Wolf, 2019/07/19
[Qemu-block] [PULL 06/13] tests: Lock AioContexts in test-block-iothread, Kevin Wolf, 2019/07/19
[Qemu-block] [PULL 07/13] block: Do not poll in bdrv_do_drained_end(), Kevin Wolf, 2019/07/19
[Qemu-block] [PULL 09/13] block: Loop unsafely in bdrv*drained_end(),
Kevin Wolf <=
[Qemu-block] [PULL 08/13] tests: Extend commit by drained_end test, Kevin Wolf, 2019/07/19
[Qemu-block] [PULL 12/13] vl: Drain before (block) job cancel when quitting, Kevin Wolf, 2019/07/19
[Qemu-block] [PULL 10/13] iotests: Add @has_quit to vm.shutdown(), Kevin Wolf, 2019/07/19
[Qemu-block] [PULL 11/13] iotests: Test commit with a filter on the chain, Kevin Wolf, 2019/07/19
[Qemu-block] [PULL 13/13] iotests: Test quitting with job on throttled node, Kevin Wolf, 2019/07/19
Re: [Qemu-block] [PULL 00/13] Block layer patches, Peter Maydell, 2019/07/22