CEPH filesystem development
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 2/6] rbd: simplify __rbd_remove_all_snaps()
Date: Thu, 26 Jul 2012 13:44:47 -0500	[thread overview]
Message-ID: <5011901F.2020704@inktank.com> (raw)
In-Reply-To: <50118F33.7080502@inktank.com>

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>
---
 drivers/block/rbd.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b9895fe..74e6a33 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);
-	}
 }

 /*
-- 
1.7.9.5


  parent reply	other threads:[~2012-07-26 18:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 18:40 [PATCH 0/6] ceph: simple cleanups (mostly rbd) Alex Elder
2012-07-26 18:44 ` [PATCH 1/6] rbd: drop extra header_rwsem init Alex Elder
2012-07-26 18:44 ` Alex Elder [this message]
2012-07-26 18:44 ` [PATCH 3/6] rbd: clean up a few dout() calls Alex Elder
2012-07-26 18:45 ` [PATCH 4/6] ceph: define snap counts as u32 everywhere Alex Elder
2012-07-26 18:45 ` [PATCH 5/6] rbd: encapsulate header validity test Alex Elder
2012-07-26 18:45 ` [PATCH 6/6] rbd: rename rbd_device->id Alex Elder
2012-07-26 19:31 ` [PATCH 0/6] ceph: simple cleanups (mostly rbd) Josh Durgin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5011901F.2020704@inktank.com \
    --to=elder@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox