diff options
author | Alex Elder <elder@inktank.com> | 2012-07-19 10:09:27 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-30 21:15:45 -0400 |
commit | a05932905695f8c6c06d353ecd52c8e5d607cc77 (patch) | |
tree | ea85e30f75e5821577186a5b190d6881458d06b2 /drivers | |
parent | a66f8c97a31fd7b2cfd7b86d4789858dbfbedffb (diff) |
rbd: simplify __rbd_remove_all_snaps()
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/rbd.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index b9895feda5ee..74e6a3329706 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1692,11 +1692,10 @@ bad: | |||
1692 | static void __rbd_remove_all_snaps(struct rbd_device *rbd_dev) | 1692 | static void __rbd_remove_all_snaps(struct rbd_device *rbd_dev) |
1693 | { | 1693 | { |
1694 | struct rbd_snap *snap; | 1694 | struct rbd_snap *snap; |
1695 | struct rbd_snap *next; | ||
1695 | 1696 | ||
1696 | while (!list_empty(&rbd_dev->snaps)) { | 1697 | list_for_each_entry_safe(snap, next, &rbd_dev->snaps, node) |
1697 | snap = list_first_entry(&rbd_dev->snaps, struct rbd_snap, node); | ||
1698 | __rbd_remove_snap_dev(rbd_dev, snap); | 1698 | __rbd_remove_snap_dev(rbd_dev, snap); |
1699 | } | ||
1700 | } | 1699 | } |
1701 | 1700 | ||
1702 | /* | 1701 | /* |