Patchwork [25/26] qcow2: Use QLIST_FOREACH_SAFE macro

login
register
mail settings
Submitter Kevin Wolf
Date April 23, 2010, 3:30 p.m.
Message ID <1272036658-26776-26-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/50844/
State New
Headers show

Comments

Kevin Wolf - April 23, 2010, 3:30 p.m.
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

Patch

diff --git a/block/qcow2.c b/block/qcow2.c
index 30ded6a..f3e3cba 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -539,14 +539,8 @@  static void run_dependent_requests(QCowL2Meta *m)
         QLIST_REMOVE(m, next_in_flight);
     }
 
-    /*
-     * Restart all dependent requests.
-     * Can't use QLIST_FOREACH here - the next link might not be the same
-     * any more after the callback  (request could depend on a different
-     * request now)
-     */
-    for (req = m->dependent_requests.lh_first; req != NULL; req = next) {
-        next = req->next_depend.le_next;
+    /* Restart all dependent requests */
+    QLIST_FOREACH_SAFE(req, &m->dependent_requests, next_depend, next) {
         qcow_aio_write_cb(req, 0);
     }