提交 0cdca3f9 编写于 作者: D Domen Puncer 提交者: Linus Torvalds

[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: NMaximilian Attems <janitor@sternwelten.at>
Signed-off-by: NDomen Puncer <domen@coderock.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 fdadd65f
...@@ -337,12 +337,10 @@ struct dentry * d_find_alias(struct inode *inode) ...@@ -337,12 +337,10 @@ struct dentry * d_find_alias(struct inode *inode)
*/ */
void d_prune_aliases(struct inode *inode) void d_prune_aliases(struct inode *inode)
{ {
struct list_head *tmp, *head = &inode->i_dentry; struct dentry *dentry;
restart: restart:
spin_lock(&dcache_lock); spin_lock(&dcache_lock);
tmp = head; list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
while ((tmp = tmp->next) != head) {
struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
if (!atomic_read(&dentry->d_count)) { if (!atomic_read(&dentry->d_count)) {
__dget_locked(dentry); __dget_locked(dentry);
...@@ -463,10 +461,7 @@ void shrink_dcache_sb(struct super_block * sb) ...@@ -463,10 +461,7 @@ void shrink_dcache_sb(struct super_block * sb)
* superblock to the most recent end of the unused list. * superblock to the most recent end of the unused list.
*/ */
spin_lock(&dcache_lock); spin_lock(&dcache_lock);
next = dentry_unused.next; list_for_each_safe(tmp, next, &dentry_unused) {
while (next != &dentry_unused) {
tmp = next;
next = tmp->next;
dentry = list_entry(tmp, struct dentry, d_lru); dentry = list_entry(tmp, struct dentry, d_lru);
if (dentry->d_sb != sb) if (dentry->d_sb != sb)
continue; continue;
...@@ -478,10 +473,7 @@ void shrink_dcache_sb(struct super_block * sb) ...@@ -478,10 +473,7 @@ void shrink_dcache_sb(struct super_block * sb)
* Pass two ... free the dentries for this superblock. * Pass two ... free the dentries for this superblock.
*/ */
repeat: repeat:
next = dentry_unused.next; list_for_each_safe(tmp, next, &dentry_unused) {
while (next != &dentry_unused) {
tmp = next;
next = tmp->next;
dentry = list_entry(tmp, struct dentry, d_lru); dentry = list_entry(tmp, struct dentry, d_lru);
if (dentry->d_sb != sb) if (dentry->d_sb != sb)
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册