aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-07-19 09:09:27 -0500
committerSage Weil <sage@inktank.com>2012-07-30 18:15:45 -0700
commita05932905695f8c6c06d353ecd52c8e5d607cc77 (patch)
treeea85e30f75e5821577186a5b190d6881458d06b2 /drivers
parenta66f8c97a31fd7b2cfd7b86d4789858dbfbedffb (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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b9895feda5e..74e6a332970 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -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);
- }
}
/*