qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v3 08/10] block: Loop unsafely in bdrv*drained_end()
Date: Fri, 19 Jul 2019 11:26:16 +0200	[thread overview]
Message-ID: <20190719092618.24891-9-mreitz@redhat.com> (raw)
In-Reply-To: <20190719092618.24891-1-mreitz@redhat.com>

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 <mreitz@redhat.com>
---
 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.21.0



  parent reply	other threads:[~2019-07-19  9:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19  9:26 [Qemu-devel] [PATCH v3 00/10] block: Delay poll when ending drained sections Max Reitz
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 01/10] block: Introduce BdrvChild.parent_quiesce_counter Max Reitz
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 02/10] tests: Add job commit by drained_end test Max Reitz
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 03/10] block: Add @drained_end_counter Max Reitz
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 04/10] block: Make bdrv_parent_drained_[^_]*() static Max Reitz
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 05/10] tests: Lock AioContexts in test-block-iothread Max Reitz
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 06/10] block: Do not poll in bdrv_do_drained_end() Max Reitz
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 07/10] tests: Extend commit by drained_end test Max Reitz
2019-07-19  9:26 ` Max Reitz [this message]
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 09/10] iotests: Add @has_quit to vm.shutdown() Max Reitz
2019-07-19  9:26 ` [Qemu-devel] [PATCH v3 10/10] iotests: Test commit with a filter on the chain Max Reitz
2019-07-19 13:16 ` [Qemu-devel] [PATCH v3 00/10] block: Delay poll when ending drained sections Kevin Wolf

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=20190719092618.24891-9-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).