All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2/7] list_for_each_entry in fs/dcache.c
@ 2005-06-20 21:57 domen
  0 siblings, 0 replies; only message in thread
From: domen @ 2005-06-20 21:57 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, Maximilian Attems, domen

[-- Attachment #1: list-for-each-fs_dcache.patch --]
[-- Type: text/plain, Size: 1802 bytes --]

From: Domen Puncer <domen@coderock.org>



First 2 are list_for_each_entry (thanks maks), second 2 list_for_each_safe.
Boot tested.

Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
 dcache.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

Index: quilt/fs/dcache.c
===================================================================
--- quilt.orig/fs/dcache.c
+++ quilt/fs/dcache.c
@@ -335,12 +335,10 @@ struct dentry * d_find_alias(struct inod
  */
 void d_prune_aliases(struct inode *inode)
 {
-	struct list_head *tmp, *head = &inode->i_dentry;
+	struct dentry *dentry;
 restart:
 	spin_lock(&dcache_lock);
-	tmp = head;
-	while ((tmp = tmp->next) != head) {
-		struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
+	list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
 		spin_lock(&dentry->d_lock);
 		if (!atomic_read(&dentry->d_count)) {
 			__dget_locked(dentry);
@@ -461,10 +459,7 @@ void shrink_dcache_sb(struct super_block
 	 * superblock to the most recent end of the unused list.
 	 */
 	spin_lock(&dcache_lock);
-	next = dentry_unused.next;
-	while (next != &dentry_unused) {
-		tmp = next;
-		next = tmp->next;
+	list_for_each_safe(tmp, next, &dentry_unused) {
 		dentry = list_entry(tmp, struct dentry, d_lru);
 		if (dentry->d_sb != sb)
 			continue;
@@ -476,10 +471,7 @@ void shrink_dcache_sb(struct super_block
 	 * Pass two ... free the dentries for this superblock.
 	 */
 repeat:
-	next = dentry_unused.next;
-	while (next != &dentry_unused) {
-		tmp = next;
-		next = tmp->next;
+	list_for_each_safe(tmp, next, &dentry_unused) {
 		dentry = list_entry(tmp, struct dentry, d_lru);
 		if (dentry->d_sb != sb)
 			continue;

--

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

only message in thread, other threads:[~2005-06-20 22:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-20 21:57 [patch 2/7] list_for_each_entry in fs/dcache.c domen

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.