Skip to content

Commit

Permalink
ocfs2: use list_for_each_entry in ocfs2_find_local_alias()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jul 14, 2012
1 parent 12447c4 commit a614a09
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions fs/ocfs2/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,30 +170,24 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode,
u64 parent_blkno,
int skip_unhashed)
{
struct list_head *p;
struct dentry *dentry = NULL;
struct dentry *dentry;

spin_lock(&inode->i_lock);
list_for_each(p, &inode->i_dentry) {
dentry = list_entry(p, struct dentry, d_alias);

list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
spin_lock(&dentry->d_lock);
if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
trace_ocfs2_find_local_alias(dentry->d_name.len,
dentry->d_name.name);

dget_dlock(dentry);
spin_unlock(&dentry->d_lock);
break;
spin_unlock(&inode->i_lock);
return dentry;
}
spin_unlock(&dentry->d_lock);

dentry = NULL;
}

spin_unlock(&inode->i_lock);

return dentry;
return NULL;
}

DEFINE_SPINLOCK(dentry_attach_lock);
Expand Down

0 comments on commit a614a09

Please sign in to comment.