* [Kernel-janitors] [patch 2.6.8] list_for_each_entry in fs/dcache.c
@ 2004-08-14 17:09 Domen Puncer
0 siblings, 0 replies; only message in thread
From: Domen Puncer @ 2004-08-14 17:09 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]
Hi.
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>
--- c/fs/dcache.c Sat Aug 14 10:57:28 2004
+++ a/fs/dcache.c Sat Aug 14 18:53:51 2004
@@ -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;
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-08-14 17:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-14 17:09 [Kernel-janitors] [patch 2.6.8] list_for_each_entry in fs/dcache.c Domen Puncer
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.