Skip to content

Commit

Permalink
9p: use clone_fid()
Browse files Browse the repository at this point in the history
in a bunch of places it cleans the things up

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Aug 3, 2016
1 parent 797fc16 commit 7d50a29
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
26 changes: 1 addition & 25 deletions fs/9p/fid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/*
Expand Down
5 changes: 4 additions & 1 deletion fs/9p/fid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion fs/9p/vfs_inode_dotl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions fs/9p/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);

Expand Down

0 comments on commit 7d50a29

Please sign in to comment.