diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-03 11:12:12 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-03 11:12:12 -0400 |
commit | 7d50a29fe43848b7d3c8309f8617db3305c0db18 (patch) | |
tree | 640ab336e23b4aa1e168ab2d0ed51a720ec8fc6d | |
parent | 797fc16d8f00bf681b7f9969c0701725b472b11a (diff) |
9p: use clone_fid()
in a bunch of places it cleans the things up
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/9p/fid.c | 26 | ||||
-rw-r--r-- | fs/9p/fid.h | 5 | ||||
-rw-r--r-- | fs/9p/vfs_inode.c | 2 | ||||
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 2 | ||||
-rw-r--r-- | fs/9p/xattr.c | 4 |
5 files changed, 8 insertions, 31 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 47db55aee7f2..60fb47469c86 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -257,36 +257,12 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) | |||
257 | return v9fs_fid_lookup_with_uid(dentry, uid, any); | 257 | return v9fs_fid_lookup_with_uid(dentry, uid, any); |
258 | } | 258 | } |
259 | 259 | ||
260 | struct p9_fid *v9fs_fid_clone(struct dentry *dentry) | ||
261 | { | ||
262 | struct p9_fid *fid, *ret; | ||
263 | |||
264 | fid = v9fs_fid_lookup(dentry); | ||
265 | if (IS_ERR(fid)) | ||
266 | return fid; | ||
267 | |||
268 | ret = p9_client_walk(fid, 0, NULL, 1); | ||
269 | return ret; | ||
270 | } | ||
271 | |||
272 | static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, kuid_t uid) | ||
273 | { | ||
274 | struct p9_fid *fid, *ret; | ||
275 | |||
276 | fid = v9fs_fid_lookup_with_uid(dentry, uid, 0); | ||
277 | if (IS_ERR(fid)) | ||
278 | return fid; | ||
279 | |||
280 | ret = p9_client_walk(fid, 0, NULL, 1); | ||
281 | return ret; | ||
282 | } | ||
283 | |||
284 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) | 260 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) |
285 | { | 261 | { |
286 | int err; | 262 | int err; |
287 | struct p9_fid *fid; | 263 | struct p9_fid *fid; |
288 | 264 | ||
289 | fid = v9fs_fid_clone_with_uid(dentry, GLOBAL_ROOT_UID); | 265 | fid = clone_fid(v9fs_fid_lookup_with_uid(dentry, GLOBAL_ROOT_UID, 0)); |
290 | if (IS_ERR(fid)) | 266 | if (IS_ERR(fid)) |
291 | goto error_out; | 267 | goto error_out; |
292 | /* | 268 | /* |
diff --git a/fs/9p/fid.h b/fs/9p/fid.h index d4c5002d56ad..4491bcaf42b8 100644 --- a/fs/9p/fid.h +++ b/fs/9p/fid.h | |||
@@ -28,11 +28,14 @@ static inline struct p9_fid *v9fs_parent_fid(struct dentry *dentry) | |||
28 | { | 28 | { |
29 | return v9fs_fid_lookup(dentry->d_parent); | 29 | return v9fs_fid_lookup(dentry->d_parent); |
30 | } | 30 | } |
31 | struct p9_fid *v9fs_fid_clone(struct dentry *dentry); | ||
32 | void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid); | 31 | void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid); |
33 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry); | 32 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry); |
34 | static inline struct p9_fid *clone_fid(struct p9_fid *fid) | 33 | static inline struct p9_fid *clone_fid(struct p9_fid *fid) |
35 | { | 34 | { |
36 | return IS_ERR(fid) ? fid : p9_client_walk(fid, 0, NULL, 1); | 35 | return IS_ERR(fid) ? fid : p9_client_walk(fid, 0, NULL, 1); |
37 | } | 36 | } |
37 | static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry) | ||
38 | { | ||
39 | return clone_fid(v9fs_fid_lookup(dentry)); | ||
40 | } | ||
38 | #endif | 41 | #endif |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 26189eebcd1c..8b1999b528e9 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -661,7 +661,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
661 | } | 661 | } |
662 | 662 | ||
663 | /* clone a fid to use for creation */ | 663 | /* clone a fid to use for creation */ |
664 | ofid = p9_client_walk(dfid, 0, NULL, 1); | 664 | ofid = clone_fid(dfid); |
665 | if (IS_ERR(ofid)) { | 665 | if (IS_ERR(ofid)) { |
666 | err = PTR_ERR(ofid); | 666 | err = PTR_ERR(ofid); |
667 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); | 667 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 2ed04c2fe7af..eeabcb0bad12 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -281,7 +281,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, | |||
281 | } | 281 | } |
282 | 282 | ||
283 | /* clone a fid to use for creation */ | 283 | /* clone a fid to use for creation */ |
284 | ofid = p9_client_walk(dfid, 0, NULL, 1); | 284 | ofid = clone_fid(dfid); |
285 | if (IS_ERR(ofid)) { | 285 | if (IS_ERR(ofid)) { |
286 | err = PTR_ERR(ofid); | 286 | err = PTR_ERR(ofid); |
287 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); | 287 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); |
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c index a6bd349bab23..f329eee6dc93 100644 --- a/fs/9p/xattr.c +++ b/fs/9p/xattr.c | |||
@@ -97,8 +97,6 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name, | |||
97 | const void *value, size_t value_len, int flags) | 97 | const void *value, size_t value_len, int flags) |
98 | { | 98 | { |
99 | struct p9_fid *fid = v9fs_fid_lookup(dentry); | 99 | struct p9_fid *fid = v9fs_fid_lookup(dentry); |
100 | if (IS_ERR(fid)) | ||
101 | return PTR_ERR(fid); | ||
102 | return v9fs_fid_xattr_set(fid, name, value, value_len, flags); | 100 | return v9fs_fid_xattr_set(fid, name, value, value_len, flags); |
103 | } | 101 | } |
104 | 102 | ||
@@ -115,7 +113,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, | |||
115 | name, value_len, flags); | 113 | name, value_len, flags); |
116 | 114 | ||
117 | /* Clone it */ | 115 | /* Clone it */ |
118 | fid = p9_client_walk(fid, 0, NULL, 1); | 116 | fid = clone_fid(fid); |
119 | if (IS_ERR(fid)) | 117 | if (IS_ERR(fid)) |
120 | return PTR_ERR(fid); | 118 | return PTR_ERR(fid); |
121 | 119 | ||