9p: use clone_fid()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 3 Aug 2016 15:12:12 +0000 (11:12 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 3 Aug 2016 15:12:12 +0000 (11:12 -0400)
in a bunch of places it cleans the things up

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/9p/fid.c
fs/9p/fid.h
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c
fs/9p/xattr.c

index 47db55a..60fb474 100644 (file)
@@ -257,36 +257,12 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
        return v9fs_fid_lookup_with_uid(dentry, uid, any);
 }
 
-struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
-{
-       struct p9_fid *fid, *ret;
-
-       fid = v9fs_fid_lookup(dentry);
-       if (IS_ERR(fid))
-               return fid;
-
-       ret = p9_client_walk(fid, 0, NULL, 1);
-       return ret;
-}
-
-static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, kuid_t uid)
-{
-       struct p9_fid *fid, *ret;
-
-       fid = v9fs_fid_lookup_with_uid(dentry, uid, 0);
-       if (IS_ERR(fid))
-               return fid;
-
-       ret = p9_client_walk(fid, 0, NULL, 1);
-       return ret;
-}
-
 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
 {
        int err;
        struct p9_fid *fid;
 
-       fid = v9fs_fid_clone_with_uid(dentry, GLOBAL_ROOT_UID);
+       fid = clone_fid(v9fs_fid_lookup_with_uid(dentry, GLOBAL_ROOT_UID, 0));
        if (IS_ERR(fid))
                goto error_out;
        /*
index d4c5002..4491bca 100644 (file)
@@ -28,11 +28,14 @@ static inline struct p9_fid *v9fs_parent_fid(struct dentry *dentry)
 {
        return v9fs_fid_lookup(dentry->d_parent);
 }
-struct p9_fid *v9fs_fid_clone(struct dentry *dentry);
 void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid);
 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry);
 static inline struct p9_fid *clone_fid(struct p9_fid *fid)
 {
        return IS_ERR(fid) ? fid :  p9_client_walk(fid, 0, NULL, 1);
 }
+static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
+{
+       return clone_fid(v9fs_fid_lookup(dentry));
+}
 #endif
index 26189ee..8b1999b 100644 (file)
@@ -661,7 +661,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
        }
 
        /* clone a fid to use for creation */
-       ofid = p9_client_walk(dfid, 0, NULL, 1);
+       ofid = clone_fid(dfid);
        if (IS_ERR(ofid)) {
                err = PTR_ERR(ofid);
                p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
index 2ed04c2..eeabcb0 100644 (file)
@@ -281,7 +281,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
        }
 
        /* clone a fid to use for creation */
-       ofid = p9_client_walk(dfid, 0, NULL, 1);
+       ofid = clone_fid(dfid);
        if (IS_ERR(ofid)) {
                err = PTR_ERR(ofid);
                p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
index a6bd349..f329eee 100644 (file)
@@ -97,8 +97,6 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
                   const void *value, size_t value_len, int flags)
 {
        struct p9_fid *fid = v9fs_fid_lookup(dentry);
-       if (IS_ERR(fid))
-               return PTR_ERR(fid);
        return v9fs_fid_xattr_set(fid, name, value, value_len, flags);
 }
 
@@ -115,7 +113,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
                 name, value_len, flags);
 
        /* Clone it */
-       fid = p9_client_walk(fid, 0, NULL, 1);
+       fid = clone_fid(fid);
        if (IS_ERR(fid))
                return PTR_ERR(fid);