All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blkid] use list_for_each_safe in garbage collection
@ 2008-06-21  3:32 Eric Sandeen
  0 siblings, 0 replies; only message in thread
From: Eric Sandeen @ 2008-06-21  3:32 UTC (permalink / raw)
  To: ext4 development; +Cc: Theodore Tso

We need to use list_for_each_safe in case a device gets removed
from the list during garbage collection.

Also make the manpage slightly more informative about
what the -g garbage collection option does.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Index: e2fsprogs-1.41/lib/blkid/cache.c
===================================================================
--- e2fsprogs-1.41.orig/lib/blkid/cache.c
+++ e2fsprogs-1.41/lib/blkid/cache.c
@@ -154,13 +154,13 @@ void blkid_put_cache(blkid_cache cache)
 
 void blkid_gc_cache(blkid_cache cache)
 {
-	struct list_head *p;
+	struct list_head *p, *pnext;
 	struct stat st;
 
 	if (!cache)
 		return;
 
-	list_for_each(p, &cache->bic_devs) {
+	list_for_each_safe(p, pnext, &cache->bic_devs) {
 		blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
 		if (!p)
 			break;
Index: e2fsprogs-1.41/misc/blkid.8.in
===================================================================
--- e2fsprogs-1.41.orig/misc/blkid.8.in
+++ e2fsprogs-1.41/misc/blkid.8.in
@@ -61,7 +61,8 @@ scanned but not necessarily available at
 .IR /dev/null.
 .TP
 .B \-g
-Perform a garbage collection pass on the blkid cache.
+Perform a garbage collection pass on the blkid cache to remove
+devices which no longer exist.
 .TP
 .B \-h
 Display a usage message and exit.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-21  3:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-21  3:32 [PATCH blkid] use list_for_each_safe in garbage collection Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.