提交 c4d30967 编写于 作者: A Al Viro

9p: turn fid->dlist into hlist

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 634095da
...@@ -54,12 +54,12 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) ...@@ -54,12 +54,12 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)
if (!dent) if (!dent)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&dent->fidlist); INIT_HLIST_HEAD(&dent->fidlist);
dentry->d_fsdata = dent; dentry->d_fsdata = dent;
} }
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
list_add(&fid->dlist, &dent->fidlist); hlist_add_head(&fid->dlist, &dent->fidlist);
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
return 0; return 0;
...@@ -84,8 +84,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) ...@@ -84,8 +84,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
dent = (struct v9fs_dentry *) dentry->d_fsdata; dent = (struct v9fs_dentry *) dentry->d_fsdata;
ret = NULL; ret = NULL;
if (dent) { if (dent) {
struct hlist_node *n;
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
list_for_each_entry(fid, &dent->fidlist, dlist) { hlist_for_each_entry(fid, n, &dent->fidlist, dlist) {
if (any || uid_eq(fid->uid, uid)) { if (any || uid_eq(fid->uid, uid)) {
ret = fid; ret = fid;
break; break;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* Design and Implementation of the Linux 9P File System documentation * Design and Implementation of the Linux 9P File System documentation
*/ */
struct v9fs_dentry { struct v9fs_dentry {
struct list_head fidlist; struct hlist_head fidlist;
}; };
struct p9_fid *v9fs_fid_lookup(struct dentry *dentry); struct p9_fid *v9fs_fid_lookup(struct dentry *dentry);
......
...@@ -84,16 +84,13 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry) ...@@ -84,16 +84,13 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry)
static void v9fs_dentry_release(struct dentry *dentry) static void v9fs_dentry_release(struct dentry *dentry)
{ {
struct v9fs_dentry *dent; struct v9fs_dentry *dent;
struct p9_fid *temp, *current_fid;
p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n", p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
dentry->d_name.name, dentry); dentry->d_name.name, dentry);
dent = dentry->d_fsdata; dent = dentry->d_fsdata;
if (dent) { if (dent) {
list_for_each_entry_safe(current_fid, temp, &dent->fidlist, struct hlist_node *p, *n;
dlist) { hlist_for_each_safe(p, n, &dent->fidlist)
p9_client_clunk(current_fid); p9_client_clunk(hlist_entry(p, struct p9_fid, dlist));
}
kfree(dent); kfree(dent);
dentry->d_fsdata = NULL; dentry->d_fsdata = NULL;
......
...@@ -192,7 +192,7 @@ struct p9_fid { ...@@ -192,7 +192,7 @@ struct p9_fid {
void *rdir; void *rdir;
struct list_head flist; struct list_head flist;
struct list_head dlist; /* list of all fids attached to a dentry */ struct hlist_node dlist; /* list of all fids attached to a dentry */
}; };
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册