list_for_each_entry in fs/dcache.c
Subsystems (2)
PATCH 1/1 list_for_each_entry in fs/dcache.c
Hi.
First 2 are list_for_each_entry (thanks maks), second 2 list_for_each_safe. Boot tested.
Signed-off-by Domen Puncer <[email protected]>
fs/dcache.c +5 -20
@@ -288,17 +288,10 @@struct dentry *d_find_alias (struct inode *inode) { -struct list_head *head, *next, *tmp;struct dentry *alias, *discon_alias=NULL ;spin_lock (&dcache_lock); - head = &inode->i_dentry; - next = inode->i_dentry.next; -while (next != head) { - tmp = next; - next = tmp->next; -prefetch (next); - alias = list_entry(tmp, struct dentry, d_alias); +list_for_each_entry (alias, &inode->i_dentry, d_alias) {if (!d_unhashed (alias)) {if (alias->d_flags &DCACHE_DISCONNECTED ) discon_alias = alias;
@@ -321,12 +314,10 @@*/ 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) {if (!atomic_read (&dentry->d_count)) {__dget_locked (dentry);__d_drop (dentry);
@@ -442,10 +433,7 @@* 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 ;
@@ -457,10 +445,7 @@* 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 ;
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors