Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

9p: turn fid->dlist into hlist

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro c4d30967 634095da

+9 -11
+4 -3
fs/9p/fid.c
··· 54 54 if (!dent) 55 55 return -ENOMEM; 56 56 57 - INIT_LIST_HEAD(&dent->fidlist); 57 + INIT_HLIST_HEAD(&dent->fidlist); 58 58 dentry->d_fsdata = dent; 59 59 } 60 60 61 61 spin_lock(&dentry->d_lock); 62 - list_add(&fid->dlist, &dent->fidlist); 62 + hlist_add_head(&fid->dlist, &dent->fidlist); 63 63 spin_unlock(&dentry->d_lock); 64 64 65 65 return 0; ··· 84 84 dent = (struct v9fs_dentry *) dentry->d_fsdata; 85 85 ret = NULL; 86 86 if (dent) { 87 + struct hlist_node *n; 87 88 spin_lock(&dentry->d_lock); 88 - list_for_each_entry(fid, &dent->fidlist, dlist) { 89 + hlist_for_each_entry(fid, n, &dent->fidlist, dlist) { 89 90 if (any || uid_eq(fid->uid, uid)) { 90 91 ret = fid; 91 92 break;
+1 -1
fs/9p/fid.h
··· 40 40 * Design and Implementation of the Linux 9P File System documentation 41 41 */ 42 42 struct v9fs_dentry { 43 - struct list_head fidlist; 43 + struct hlist_head fidlist; 44 44 }; 45 45 46 46 struct p9_fid *v9fs_fid_lookup(struct dentry *dentry);
+3 -6
fs/9p/vfs_dentry.c
··· 84 84 static void v9fs_dentry_release(struct dentry *dentry) 85 85 { 86 86 struct v9fs_dentry *dent; 87 - struct p9_fid *temp, *current_fid; 88 - 89 87 p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n", 90 88 dentry->d_name.name, dentry); 91 89 dent = dentry->d_fsdata; 92 90 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)); 97 94 98 95 kfree(dent); 99 96 dentry->d_fsdata = NULL;
+1 -1
include/net/9p/client.h
··· 192 192 void *rdir; 193 193 194 194 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 */ 196 196 }; 197 197 198 198 /**