Skip to content

Commit

Permalink
rbd: simplify __rbd_remove_all_snaps()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Elder authored and Sage Weil committed Jul 31, 2012
1 parent a66f8c9 commit a059329
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
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);
}
}

/*
Expand Down

0 comments on commit a059329

Please sign in to comment.