use list_for_each() in fs/dcache.c
PATCH 1/1 use list_for_each() in fs/dcache.c
Use list_for_each() where applicable
From: Domen Puncer <[email protected]>
- for (list = ymf_devs.next; list != &ymf_devs; list = list->next) {
+ list_for_each(list, &ymf_devs) {
pure cosmetic change, defined as a preprocessor macro in:include/linux/list.h
domen stated in his mail from 12. July not to be shure about this one, yes it compiles but not done further testings.
please apply
maks
fs/dcache.c +5 -16
@@ -279,15 +279,11 @@struct dentry *d_find_alias (struct inode *inode) { -struct list_head *head, *next, *tmp; +struct list_head *tmp, *next;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; +list_for_each_safe (tmp, next, &inode->i_dentry) {prefetch (next); alias = list_entry(tmp, struct dentry, d_alias);if (!d_unhashed (alias)) {
@@ -315,8 +311,7 @@struct list_head *tmp, *head = &inode->i_dentry; restart:spin_lock (&dcache_lock); - tmp = head; -while ((tmp = tmp->next) != head) { +list_for_each (tmp, head) { struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);if (!atomic_read (&dentry->d_count)) {__dget_locked (dentry);
@@ -430,10 +425,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 ;
@@ -445,10 +437,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