diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-09 13:09:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:32:53 -0400 |
commit | a614a092bf28d58c742b9ec43209f3f78c3d9fb3 (patch) | |
tree | 6edc881fda24eea91781320a87c6066f0ba5d1bd /fs/ocfs2/dcache.c | |
parent | 12447c40394695c9a19920c65fea124bdf3ea034 (diff) |
ocfs2: use list_for_each_entry in ocfs2_find_local_alias()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ocfs2/dcache.c')
-rw-r--r-- | fs/ocfs2/dcache.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index e5ba34818332..a40edc1e1d86 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
@@ -170,13 +170,10 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode, | |||
170 | u64 parent_blkno, | 170 | u64 parent_blkno, |
171 | int skip_unhashed) | 171 | int skip_unhashed) |
172 | { | 172 | { |
173 | struct list_head *p; | 173 | struct dentry *dentry; |
174 | struct dentry *dentry = NULL; | ||
175 | 174 | ||
176 | spin_lock(&inode->i_lock); | 175 | spin_lock(&inode->i_lock); |
177 | list_for_each(p, &inode->i_dentry) { | 176 | list_for_each_entry(dentry, &inode->i_dentry, d_alias) { |
178 | dentry = list_entry(p, struct dentry, d_alias); | ||
179 | |||
180 | spin_lock(&dentry->d_lock); | 177 | spin_lock(&dentry->d_lock); |
181 | if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { | 178 | if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { |
182 | trace_ocfs2_find_local_alias(dentry->d_name.len, | 179 | trace_ocfs2_find_local_alias(dentry->d_name.len, |
@@ -184,16 +181,13 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode, | |||
184 | 181 | ||
185 | dget_dlock(dentry); | 182 | dget_dlock(dentry); |
186 | spin_unlock(&dentry->d_lock); | 183 | spin_unlock(&dentry->d_lock); |
187 | break; | 184 | spin_unlock(&inode->i_lock); |
185 | return dentry; | ||
188 | } | 186 | } |
189 | spin_unlock(&dentry->d_lock); | 187 | spin_unlock(&dentry->d_lock); |
190 | |||
191 | dentry = NULL; | ||
192 | } | 188 | } |
193 | |||
194 | spin_unlock(&inode->i_lock); | 189 | spin_unlock(&inode->i_lock); |
195 | 190 | return NULL; | |
196 | return dentry; | ||
197 | } | 191 | } |
198 | 192 | ||
199 | DEFINE_SPINLOCK(dentry_attach_lock); | 193 | DEFINE_SPINLOCK(dentry_attach_lock); |