diff options
author | Jan Blunck <jblunck@suse.de> | 2008-02-14 22:38:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-15 00:17:08 -0500 |
commit | 448678a0f3cdd0157f00e98bd337e32030273637 (patch) | |
tree | 12b4fb7875dd500b1923d3eec316db4c1e1a3692 /fs | |
parent | 3dcd25f37cfe2943beca93f41f50994108248a60 (diff) |
d_path: Make get_dcookie() use a struct path argument
get_dcookie() is always called with a dentry and a vfsmount from a struct
path. Make get_dcookie() take it directly as an argument.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Acked-by: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dcookies.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/fs/dcookies.c b/fs/dcookies.c index 792cbf55fa95..13c29f1f711f 100644 --- a/fs/dcookies.c +++ b/fs/dcookies.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/dcookies.h> | 25 | #include <linux/dcookies.h> |
26 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
27 | #include <linux/path.h> | ||
27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
28 | 29 | ||
29 | /* The dcookies are allocated from a kmem_cache and | 30 | /* The dcookies are allocated from a kmem_cache and |
@@ -31,8 +32,7 @@ | |||
31 | * code here is particularly performance critical | 32 | * code here is particularly performance critical |
32 | */ | 33 | */ |
33 | struct dcookie_struct { | 34 | struct dcookie_struct { |
34 | struct dentry * dentry; | 35 | struct path path; |
35 | struct vfsmount * vfsmnt; | ||
36 | struct list_head hash_list; | 36 | struct list_head hash_list; |
37 | }; | 37 | }; |
38 | 38 | ||
@@ -51,7 +51,7 @@ static inline int is_live(void) | |||
51 | /* The dentry is locked, its address will do for the cookie */ | 51 | /* The dentry is locked, its address will do for the cookie */ |
52 | static inline unsigned long dcookie_value(struct dcookie_struct * dcs) | 52 | static inline unsigned long dcookie_value(struct dcookie_struct * dcs) |
53 | { | 53 | { |
54 | return (unsigned long)dcs->dentry; | 54 | return (unsigned long)dcs->path.dentry; |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
@@ -89,19 +89,17 @@ static void hash_dcookie(struct dcookie_struct * dcs) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | static struct dcookie_struct * alloc_dcookie(struct dentry * dentry, | 92 | static struct dcookie_struct *alloc_dcookie(struct path *path) |
93 | struct vfsmount * vfsmnt) | ||
94 | { | 93 | { |
95 | struct dcookie_struct * dcs = kmem_cache_alloc(dcookie_cache, GFP_KERNEL); | 94 | struct dcookie_struct *dcs = kmem_cache_alloc(dcookie_cache, |
95 | GFP_KERNEL); | ||
96 | if (!dcs) | 96 | if (!dcs) |
97 | return NULL; | 97 | return NULL; |
98 | 98 | ||
99 | dentry->d_cookie = dcs; | 99 | path->dentry->d_cookie = dcs; |
100 | 100 | dcs->path = *path; | |
101 | dcs->dentry = dget(dentry); | 101 | path_get(path); |
102 | dcs->vfsmnt = mntget(vfsmnt); | ||
103 | hash_dcookie(dcs); | 102 | hash_dcookie(dcs); |
104 | |||
105 | return dcs; | 103 | return dcs; |
106 | } | 104 | } |
107 | 105 | ||
@@ -109,8 +107,7 @@ static struct dcookie_struct * alloc_dcookie(struct dentry * dentry, | |||
109 | /* This is the main kernel-side routine that retrieves the cookie | 107 | /* This is the main kernel-side routine that retrieves the cookie |
110 | * value for a dentry/vfsmnt pair. | 108 | * value for a dentry/vfsmnt pair. |
111 | */ | 109 | */ |
112 | int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, | 110 | int get_dcookie(struct path *path, unsigned long *cookie) |
113 | unsigned long * cookie) | ||
114 | { | 111 | { |
115 | int err = 0; | 112 | int err = 0; |
116 | struct dcookie_struct * dcs; | 113 | struct dcookie_struct * dcs; |
@@ -122,10 +119,10 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, | |||
122 | goto out; | 119 | goto out; |
123 | } | 120 | } |
124 | 121 | ||
125 | dcs = dentry->d_cookie; | 122 | dcs = path->dentry->d_cookie; |
126 | 123 | ||
127 | if (!dcs) | 124 | if (!dcs) |
128 | dcs = alloc_dcookie(dentry, vfsmnt); | 125 | dcs = alloc_dcookie(path); |
129 | 126 | ||
130 | if (!dcs) { | 127 | if (!dcs) { |
131 | err = -ENOMEM; | 128 | err = -ENOMEM; |
@@ -174,7 +171,7 @@ asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) | |||
174 | goto out; | 171 | goto out; |
175 | 172 | ||
176 | /* FIXME: (deleted) ? */ | 173 | /* FIXME: (deleted) ? */ |
177 | path = d_path(dcs->dentry, dcs->vfsmnt, kbuf, PAGE_SIZE); | 174 | path = d_path(dcs->path.dentry, dcs->path.mnt, kbuf, PAGE_SIZE); |
178 | 175 | ||
179 | if (IS_ERR(path)) { | 176 | if (IS_ERR(path)) { |
180 | err = PTR_ERR(path); | 177 | err = PTR_ERR(path); |
@@ -254,9 +251,8 @@ out_kmem: | |||
254 | 251 | ||
255 | static void free_dcookie(struct dcookie_struct * dcs) | 252 | static void free_dcookie(struct dcookie_struct * dcs) |
256 | { | 253 | { |
257 | dcs->dentry->d_cookie = NULL; | 254 | dcs->path.dentry->d_cookie = NULL; |
258 | dput(dcs->dentry); | 255 | path_put(&dcs->path); |
259 | mntput(dcs->vfsmnt); | ||
260 | kmem_cache_free(dcookie_cache, dcs); | 256 | kmem_cache_free(dcookie_cache, dcs); |
261 | } | 257 | } |
262 | 258 | ||