Skip to content

Commit c4d3096

Browse files
author
Al Viro
committed
9p: turn fid->dlist into hlist
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 634095d commit c4d3096

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

‎fs/9p/fid.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)
5454
if (!dent)
5555
return -ENOMEM;
5656

57-
INIT_LIST_HEAD(&dent->fidlist);
57+
INIT_HLIST_HEAD(&dent->fidlist);
5858
dentry->d_fsdata = dent;
5959
}
6060

6161
spin_lock(&dentry->d_lock);
62-
list_add(&fid->dlist, &dent->fidlist);
62+
hlist_add_head(&fid->dlist, &dent->fidlist);
6363
spin_unlock(&dentry->d_lock);
6464

6565
return 0;
@@ -84,8 +84,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
8484
dent = (struct v9fs_dentry *) dentry->d_fsdata;
8585
ret = NULL;
8686
if (dent) {
87+
struct hlist_node *n;
8788
spin_lock(&dentry->d_lock);
88-
list_for_each_entry(fid, &dent->fidlist, dlist) {
89+
hlist_for_each_entry(fid, n, &dent->fidlist, dlist) {
8990
if (any || uid_eq(fid->uid, uid)) {
9091
ret = fid;
9192
break;

‎fs/9p/fid.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* Design and Implementation of the Linux 9P File System documentation
4141
*/
4242
struct v9fs_dentry {
43-
struct list_head fidlist;
43+
struct hlist_head fidlist;
4444
};
4545

4646
struct p9_fid *v9fs_fid_lookup(struct dentry *dentry);

‎fs/9p/vfs_dentry.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,13 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry)
8484
static void v9fs_dentry_release(struct dentry *dentry)
8585
{
8686
struct v9fs_dentry *dent;
87-
struct p9_fid *temp, *current_fid;
88-
8987
p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
9088
dentry->d_name.name, dentry);
9189
dent = dentry->d_fsdata;
9290
if (dent) {
93-
list_for_each_entry_safe(current_fid, temp, &dent->fidlist,
94-
dlist) {
95-
p9_client_clunk(current_fid);
96-
}
91+
struct hlist_node *p, *n;
92+
hlist_for_each_safe(p, n, &dent->fidlist)
93+
p9_client_clunk(hlist_entry(p, struct p9_fid, dlist));
9794

9895
kfree(dent);
9996
dentry->d_fsdata = NULL;

‎include/net/9p/client.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct p9_fid {
192192
void *rdir;
193193

194194
struct list_head flist;
195-
struct list_head dlist; /* list of all fids attached to a dentry */
195+
struct hlist_node dlist; /* list of all fids attached to a dentry */
196196
};
197197

198198
/**

0 commit comments

Comments
 (0)