public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Cc: Theodore Tso <tytso@mit.edu>
Subject: [PATCH blkid] use list_for_each_safe in garbage collection
Date: Fri, 20 Jun 2008 22:32:49 -0500	[thread overview]
Message-ID: <485C7661.5080002@redhat.com> (raw)

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.


                 reply	other threads:[~2008-06-21  3:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=485C7661.5080002@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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