ncpfs: use list_for_each_entry() for d_subdirs walk
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>hifive-unleashed-5.1
parent
5e6123f347
commit
821cc3070f
|
@ -388,7 +388,6 @@ static struct dentry *
|
||||||
ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
|
ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
|
||||||
{
|
{
|
||||||
struct dentry *dent = dentry;
|
struct dentry *dent = dentry;
|
||||||
struct list_head *next;
|
|
||||||
|
|
||||||
if (d_validate(dent, parent)) {
|
if (d_validate(dent, parent)) {
|
||||||
if (dent->d_name.len <= NCP_MAXPATHLEN &&
|
if (dent->d_name.len <= NCP_MAXPATHLEN &&
|
||||||
|
@ -404,9 +403,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
|
||||||
|
|
||||||
/* If a pointer is invalid, we search the dentry. */
|
/* If a pointer is invalid, we search the dentry. */
|
||||||
spin_lock(&parent->d_lock);
|
spin_lock(&parent->d_lock);
|
||||||
next = parent->d_subdirs.next;
|
list_for_each_entry(dent, &parent->d_subdirs, d_u.d_child) {
|
||||||
while (next != &parent->d_subdirs) {
|
|
||||||
dent = list_entry(next, struct dentry, d_u.d_child);
|
|
||||||
if ((unsigned long)dent->d_fsdata == fpos) {
|
if ((unsigned long)dent->d_fsdata == fpos) {
|
||||||
if (dent->d_inode)
|
if (dent->d_inode)
|
||||||
dget(dent);
|
dget(dent);
|
||||||
|
@ -415,7 +412,6 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
|
||||||
spin_unlock(&parent->d_lock);
|
spin_unlock(&parent->d_lock);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
next = next->next;
|
|
||||||
}
|
}
|
||||||
spin_unlock(&parent->d_lock);
|
spin_unlock(&parent->d_lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -188,20 +188,14 @@ static inline void
|
||||||
ncp_renew_dentries(struct dentry *parent)
|
ncp_renew_dentries(struct dentry *parent)
|
||||||
{
|
{
|
||||||
struct ncp_server *server = NCP_SERVER(parent->d_inode);
|
struct ncp_server *server = NCP_SERVER(parent->d_inode);
|
||||||
struct list_head *next;
|
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
|
|
||||||
spin_lock(&parent->d_lock);
|
spin_lock(&parent->d_lock);
|
||||||
next = parent->d_subdirs.next;
|
list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) {
|
||||||
while (next != &parent->d_subdirs) {
|
|
||||||
dentry = list_entry(next, struct dentry, d_u.d_child);
|
|
||||||
|
|
||||||
if (dentry->d_fsdata == NULL)
|
if (dentry->d_fsdata == NULL)
|
||||||
ncp_age_dentry(server, dentry);
|
ncp_age_dentry(server, dentry);
|
||||||
else
|
else
|
||||||
ncp_new_dentry(dentry);
|
ncp_new_dentry(dentry);
|
||||||
|
|
||||||
next = next->next;
|
|
||||||
}
|
}
|
||||||
spin_unlock(&parent->d_lock);
|
spin_unlock(&parent->d_lock);
|
||||||
}
|
}
|
||||||
|
@ -210,16 +204,12 @@ static inline void
|
||||||
ncp_invalidate_dircache_entries(struct dentry *parent)
|
ncp_invalidate_dircache_entries(struct dentry *parent)
|
||||||
{
|
{
|
||||||
struct ncp_server *server = NCP_SERVER(parent->d_inode);
|
struct ncp_server *server = NCP_SERVER(parent->d_inode);
|
||||||
struct list_head *next;
|
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
|
|
||||||
spin_lock(&parent->d_lock);
|
spin_lock(&parent->d_lock);
|
||||||
next = parent->d_subdirs.next;
|
list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) {
|
||||||
while (next != &parent->d_subdirs) {
|
|
||||||
dentry = list_entry(next, struct dentry, d_u.d_child);
|
|
||||||
dentry->d_fsdata = NULL;
|
dentry->d_fsdata = NULL;
|
||||||
ncp_age_dentry(server, dentry);
|
ncp_age_dentry(server, dentry);
|
||||||
next = next->next;
|
|
||||||
}
|
}
|
||||||
spin_unlock(&parent->d_lock);
|
spin_unlock(&parent->d_lock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue