diff options
author | Domen Puncer <domen@coderock.org> | 2005-09-10 00:27:07 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-10 10:06:32 -0700 |
commit | 0cdca3f9806a3dbaa07b5e8175000cd513ba92d4 (patch) | |
tree | 2235a2065509b74eff9d94ffcdbc8d9371f5b5ab /fs | |
parent | fdadd65fbce0ff966cb8e74247d9636f52a7fc7a (diff) | |
download | op-kernel-dev-0cdca3f9806a3dbaa07b5e8175000cd513ba92d4.zip op-kernel-dev-0cdca3f9806a3dbaa07b5e8175000cd513ba92d4.tar.gz |
[PATCH] janitor: fs/dcache.c: list_for_each*
First one is list_for_each_entry (thanks maks), second 2 list_for_each_safe.
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dcache.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index a15a2e1..7376b612 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -337,12 +337,10 @@ struct dentry * d_find_alias(struct inode *inode) */ 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); @@ -463,10 +461,7 @@ void shrink_dcache_sb(struct super_block * sb) * 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; @@ -478,10 +473,7 @@ void shrink_dcache_sb(struct super_block * sb) * 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; |