aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-09-25 23:57:58 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-10-09 02:39:16 -0400
commit821cc3070ff54e39ab6624c843f1905d737d9ac0 (patch)
treeb931db75f0713ca95fa78443f4f6ddd6cd7ec975 /fs/ncpfs
parent5e6123f3477e4260fb14392f0a88f1a842fa4d42 (diff)
ncpfs: use list_for_each_entry() for d_subdirs walk
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ncpfs')
-rw-r--r--fs/ncpfs/dir.c6
-rw-r--r--fs/ncpfs/ncplib_kernel.h14
2 files changed, 3 insertions, 17 deletions
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 08b8ea8c353e..314e7add99b8 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -388,7 +388,6 @@ static struct dentry *
388ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos) 388ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
389{ 389{
390 struct dentry *dent = dentry; 390 struct dentry *dent = dentry;
391 struct list_head *next;
392 391
393 if (d_validate(dent, parent)) { 392 if (d_validate(dent, parent)) {
394 if (dent->d_name.len <= NCP_MAXPATHLEN && 393 if (dent->d_name.len <= NCP_MAXPATHLEN &&
@@ -404,9 +403,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
404 403
405 /* If a pointer is invalid, we search the dentry. */ 404 /* If a pointer is invalid, we search the dentry. */
406 spin_lock(&parent->d_lock); 405 spin_lock(&parent->d_lock);
407 next = parent->d_subdirs.next; 406 list_for_each_entry(dent, &parent->d_subdirs, d_u.d_child) {
408 while (next != &parent->d_subdirs) {
409 dent = list_entry(next, struct dentry, d_u.d_child);
410 if ((unsigned long)dent->d_fsdata == fpos) { 407 if ((unsigned long)dent->d_fsdata == fpos) {
411 if (dent->d_inode) 408 if (dent->d_inode)
412 dget(dent); 409 dget(dent);
@@ -415,7 +412,6 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
415 spin_unlock(&parent->d_lock); 412 spin_unlock(&parent->d_lock);
416 goto out; 413 goto out;
417 } 414 }
418 next = next->next;
419 } 415 }
420 spin_unlock(&parent->d_lock); 416 spin_unlock(&parent->d_lock);
421 return NULL; 417 return NULL;
diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h
index 32c06587351a..52cb19d66ecb 100644
--- a/fs/ncpfs/ncplib_kernel.h
+++ b/fs/ncpfs/ncplib_kernel.h
@@ -188,20 +188,14 @@ static inline void
188ncp_renew_dentries(struct dentry *parent) 188ncp_renew_dentries(struct dentry *parent)
189{ 189{
190 struct ncp_server *server = NCP_SERVER(parent->d_inode); 190 struct ncp_server *server = NCP_SERVER(parent->d_inode);
191 struct list_head *next;
192 struct dentry *dentry; 191 struct dentry *dentry;
193 192
194 spin_lock(&parent->d_lock); 193 spin_lock(&parent->d_lock);
195 next = parent->d_subdirs.next; 194 list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) {
196 while (next != &parent->d_subdirs) {
197 dentry = list_entry(next, struct dentry, d_u.d_child);
198
199 if (dentry->d_fsdata == NULL) 195 if (dentry->d_fsdata == NULL)
200 ncp_age_dentry(server, dentry); 196 ncp_age_dentry(server, dentry);
201 else 197 else
202 ncp_new_dentry(dentry); 198 ncp_new_dentry(dentry);
203
204 next = next->next;
205 } 199 }
206 spin_unlock(&parent->d_lock); 200 spin_unlock(&parent->d_lock);
207} 201}
@@ -210,16 +204,12 @@ static inline void
210ncp_invalidate_dircache_entries(struct dentry *parent) 204ncp_invalidate_dircache_entries(struct dentry *parent)
211{ 205{
212 struct ncp_server *server = NCP_SERVER(parent->d_inode); 206 struct ncp_server *server = NCP_SERVER(parent->d_inode);
213 struct list_head *next;
214 struct dentry *dentry; 207 struct dentry *dentry;
215 208
216 spin_lock(&parent->d_lock); 209 spin_lock(&parent->d_lock);
217 next = parent->d_subdirs.next; 210 list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) {
218 while (next != &parent->d_subdirs) {
219 dentry = list_entry(next, struct dentry, d_u.d_child);
220 dentry->d_fsdata = NULL; 211 dentry->d_fsdata = NULL;
221 ncp_age_dentry(server, dentry); 212 ncp_age_dentry(server, dentry);
222 next = next->next;
223 } 213 }
224 spin_unlock(&parent->d_lock); 214 spin_unlock(&parent->d_lock);
225} 215}