rbd: simplify __rbd_remove_all_snaps()
authorAlex Elder <elder@inktank.com>
Thu, 19 Jul 2012 14:09:27 +0000 (09:09 -0500)
committerSage Weil <sage@inktank.com>
Tue, 31 Jul 2012 01:15:45 +0000 (18:15 -0700)
This just replaces a while loop with list_for_each_entry_safe()
in __rbd_remove_all_snaps().

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c

index b9895feda5ee1530589bc7f3483c3917f751770d..74e6a33297064ba50f89b6f5acc2d963a3e22395 100644 (file)
@@ -1692,11 +1692,10 @@ bad:
 static void __rbd_remove_all_snaps(struct rbd_device *rbd_dev)
 {
        struct rbd_snap *snap;
+       struct rbd_snap *next;
 
-       while (!list_empty(&rbd_dev->snaps)) {
-               snap = list_first_entry(&rbd_dev->snaps, struct rbd_snap, node);
+       list_for_each_entry_safe(snap, next, &rbd_dev->snaps, node)
                __rbd_remove_snap_dev(rbd_dev, snap);
-       }
 }
 
 /*