Commit a0593290 authored by Alex Elder's avatar Alex Elder Committed by Sage Weil

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: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent a66f8c97
...@@ -1692,11 +1692,10 @@ static int rbd_header_add_snap(struct rbd_device *rbd_dev, ...@@ -1692,11 +1692,10 @@ static int rbd_header_add_snap(struct rbd_device *rbd_dev,
static void __rbd_remove_all_snaps(struct rbd_device *rbd_dev) static void __rbd_remove_all_snaps(struct rbd_device *rbd_dev)
{ {
struct rbd_snap *snap; struct rbd_snap *snap;
struct rbd_snap *next;
while (!list_empty(&rbd_dev->snaps)) { list_for_each_entry_safe(snap, next, &rbd_dev->snaps, node)
snap = list_first_entry(&rbd_dev->snaps, struct rbd_snap, node);
__rbd_remove_snap_dev(rbd_dev, snap); __rbd_remove_snap_dev(rbd_dev, snap);
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment