From 3084ee95f08ce353ae26c18c7627c4e9786983ca Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 9 Jun 2012 13:03:04 -0400 Subject: affs: get rid of open-coded list_for_each_entry() Signed-off-by: Al Viro --- fs/affs/amigaffs.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'fs/affs/amigaffs.c') diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 52a6407682e..1c7fd7928d1 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -126,18 +126,13 @@ affs_fix_dcache(struct dentry *dentry, u32 entry_ino) { struct inode *inode = dentry->d_inode; void *data = dentry->d_fsdata; - struct list_head *head, *next; spin_lock(&inode->i_lock); - head = &inode->i_dentry; - next = head->next; - while (next != head) { - dentry = list_entry(next, struct dentry, d_alias); + list_for_each_entry(dentry, &inode->i_dentry, d_alias) { if (entry_ino == (u32)(long)dentry->d_fsdata) { dentry->d_fsdata = data; break; } - next = next->next; } spin_unlock(&inode->i_lock); } -- cgit v1.2.3 From 12447c40394695c9a19920c65fea124bdf3ea034 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 9 Jun 2012 13:06:09 -0400 Subject: affs: unobfuscate affs_fix_dcache() and add a comment on what it's doing Signed-off-by: Al Viro --- fs/affs/amigaffs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'fs/affs/amigaffs.c') diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 1c7fd7928d1..843cdc99480 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -122,15 +122,13 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh) } static void -affs_fix_dcache(struct dentry *dentry, u32 entry_ino) +affs_fix_dcache(struct inode *inode, u32 entry_ino) { - struct inode *inode = dentry->d_inode; - void *data = dentry->d_fsdata; - + struct dentry *dentry; spin_lock(&inode->i_lock); list_for_each_entry(dentry, &inode->i_dentry, d_alias) { if (entry_ino == (u32)(long)dentry->d_fsdata) { - dentry->d_fsdata = data; + dentry->d_fsdata = (void *)inode->i_ino; break; } } @@ -172,7 +170,11 @@ affs_remove_link(struct dentry *dentry) } affs_lock_dir(dir); - affs_fix_dcache(dentry, link_ino); + /* + * if there's a dentry for that block, make it + * refer to inode itself. + */ + affs_fix_dcache(inode, link_ino); retval = affs_remove_hash(dir, link_bh); if (retval) { affs_unlock_dir(dir); -- cgit v1.2.3 From b3d9b7a3c752dc4b6976a4ff7b8298887a5b734d Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 9 Jun 2012 13:51:19 -0400 Subject: vfs: switch i_dentry/d_alias to hlist Signed-off-by: Al Viro --- fs/affs/amigaffs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/affs/amigaffs.c') diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 843cdc99480..eb82ee53ee0 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -125,8 +125,9 @@ static void affs_fix_dcache(struct inode *inode, u32 entry_ino) { struct dentry *dentry; + struct hlist_node *p; spin_lock(&inode->i_lock); - list_for_each_entry(dentry, &inode->i_dentry, d_alias) { + hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) { if (entry_ino == (u32)(long)dentry->d_fsdata) { dentry->d_fsdata = (void *)inode->i_ino; break; -- cgit v1.2.3