diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-28 01:13:19 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-28 01:13:19 -0500 |
commit | aaeb7ecfb48ad4c8942a26874322d8918524a04f (patch) | |
tree | ae2e0dbd1cb3a199e9fd92786a0da2ba810a42ef /fs/9p | |
parent | c4d30967f3020cda9df9ee22af79cd1f2c284244 (diff) | |
download | op-kernel-dev-aaeb7ecfb48ad4c8942a26874322d8918524a04f.zip op-kernel-dev-aaeb7ecfb48ad4c8942a26874322d8918524a04f.tar.gz |
v9fs: get rid of v9fs_dentry
->d_fsdata can act as hlist_head...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/fid.c | 26 | ||||
-rw-r--r-- | fs/9p/fid.h | 20 | ||||
-rw-r--r-- | fs/9p/vfs_dentry.c | 14 |
3 files changed, 9 insertions, 51 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 49de426..ddf6189 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c @@ -43,25 +43,9 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) { - struct v9fs_dentry *dent; - - p9_debug(P9_DEBUG_VFS, "fid %d dentry %s\n", - fid->fid, dentry->d_name.name); - - dent = dentry->d_fsdata; - if (!dent) { - dent = kmalloc(sizeof(struct v9fs_dentry), GFP_KERNEL); - if (!dent) - return -ENOMEM; - - INIT_HLIST_HEAD(&dent->fidlist); - dentry->d_fsdata = dent; - } - spin_lock(&dentry->d_lock); - hlist_add_head(&fid->dlist, &dent->fidlist); + hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata); spin_unlock(&dentry->d_lock); - return 0; } @@ -75,18 +59,18 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) { - struct v9fs_dentry *dent; struct p9_fid *fid, *ret; p9_debug(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n", dentry->d_name.name, dentry, from_kuid(&init_user_ns, uid), any); - dent = (struct v9fs_dentry *) dentry->d_fsdata; ret = NULL; - if (dent) { + /* we'll recheck under lock if there's anything to look in */ + if (dentry->d_fsdata) { + struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata; struct hlist_node *n; spin_lock(&dentry->d_lock); - hlist_for_each_entry(fid, n, &dent->fidlist, dlist) { + hlist_for_each_entry(fid, n, h, dlist) { if (any || uid_eq(fid->uid, uid)) { ret = fid; break; diff --git a/fs/9p/fid.h b/fs/9p/fid.h index 86eeb34..377eb6f 100644 --- a/fs/9p/fid.h +++ b/fs/9p/fid.h @@ -23,26 +23,6 @@ #define FS_9P_FID_H #include <linux/list.h> -/** - * struct v9fs_dentry - 9p private data stored in dentry d_fsdata - * @fidlist: list of FIDs currently associated with this dentry - * - * This structure defines the 9p private data associated with - * a particular dentry. In particular, this private data is used - * to lookup which 9P FID handle should be used for a particular VFS - * operation. FID handles are associated with dentries instead of - * inodes in order to more closely map functionality to the Plan 9 - * expected behavior for FID reclaimation and tracking. - * - * Protected by ->d_lock of dentry it belongs to. - * - * See Also: Mapping FIDs to Linux VFS model in - * Design and Implementation of the Linux 9P File System documentation - */ -struct v9fs_dentry { - struct hlist_head fidlist; -}; - struct p9_fid *v9fs_fid_lookup(struct dentry *dentry); struct p9_fid *v9fs_fid_clone(struct dentry *dentry); int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid); diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index fcd4983..f039b10 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c @@ -83,18 +83,12 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry) static void v9fs_dentry_release(struct dentry *dentry) { - struct v9fs_dentry *dent; + struct hlist_node *p, *n; p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, dentry); - dent = dentry->d_fsdata; - if (dent) { - struct hlist_node *p, *n; - hlist_for_each_safe(p, n, &dent->fidlist) - p9_client_clunk(hlist_entry(p, struct p9_fid, dlist)); - - kfree(dent); - dentry->d_fsdata = NULL; - } + hlist_for_each_safe(p, n, (struct hlist_head *)&dentry->d_fsdata) + p9_client_clunk(hlist_entry(p, struct p9_fid, dlist)); + dentry->d_fsdata = NULL; } static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) |