Commit ff5e72eb authored by Dominique Martinet's avatar Dominique Martinet

9p: apply review requests for fid refcounting

Fix style issues in parent commit ("apply review requests for fid
refcounting"), no functional change.

Link: http://lkml.kernel.org/r/1605802012-31133-2-git-send-email-asmadeus@codewreck.org
Fixes: 6636b6dc ("9p: add refcount to p9_fid struct")
Signed-off-by: default avatarDominique Martinet <asmadeus@codewreck.org>
parent 6636b6dc
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
static inline void __add_fid(struct dentry *dentry, struct p9_fid *fid) static inline void __add_fid(struct dentry *dentry, struct p9_fid *fid)
{ {
atomic_set(&fid->count, 1);
hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata); hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata);
} }
...@@ -62,7 +61,7 @@ static struct p9_fid *v9fs_fid_find_inode(struct inode *inode, kuid_t uid) ...@@ -62,7 +61,7 @@ static struct p9_fid *v9fs_fid_find_inode(struct inode *inode, kuid_t uid)
} }
} }
if (ret && !IS_ERR(ret)) if (ret && !IS_ERR(ret))
atomic_inc(&ret->count); refcount_inc(&ret->count);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
return ret; return ret;
} }
...@@ -77,7 +76,6 @@ static struct p9_fid *v9fs_fid_find_inode(struct inode *inode, kuid_t uid) ...@@ -77,7 +76,6 @@ static struct p9_fid *v9fs_fid_find_inode(struct inode *inode, kuid_t uid)
void v9fs_open_fid_add(struct inode *inode, struct p9_fid *fid) void v9fs_open_fid_add(struct inode *inode, struct p9_fid *fid)
{ {
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
atomic_set(&fid->count, 1);
hlist_add_head(&fid->ilist, (struct hlist_head *)&inode->i_private); hlist_add_head(&fid->ilist, (struct hlist_head *)&inode->i_private);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
} }
...@@ -110,7 +108,7 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) ...@@ -110,7 +108,7 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
hlist_for_each_entry(fid, h, dlist) { hlist_for_each_entry(fid, h, dlist) {
if (any || uid_eq(fid->uid, uid)) { if (any || uid_eq(fid->uid, uid)) {
ret = fid; ret = fid;
atomic_inc(&ret->count); refcount_inc(&ret->count);
break; break;
} }
} }
...@@ -201,7 +199,7 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, ...@@ -201,7 +199,7 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
} }
/* If we are root ourself just return that */ /* If we are root ourself just return that */
if (dentry->d_sb->s_root == dentry) { if (dentry->d_sb->s_root == dentry) {
atomic_inc(&fid->count); refcount_inc(&fid->count);
return fid; return fid;
} }
/* /*
...@@ -250,7 +248,7 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, ...@@ -250,7 +248,7 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
fid = ERR_PTR(-ENOENT); fid = ERR_PTR(-ENOENT);
} else { } else {
__add_fid(dentry, fid); __add_fid(dentry, fid);
atomic_inc(&fid->count); refcount_inc(&fid->count);
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
} }
} }
......
...@@ -28,7 +28,7 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry) ...@@ -28,7 +28,7 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
if (!fid || IS_ERR(fid)) if (!fid || IS_ERR(fid))
return fid; return fid;
nfid = p9_client_walk(fid, 0, NULL, 1); nfid = clone_fid(fid);
p9_client_clunk(fid); p9_client_clunk(fid);
return nfid; return nfid;
} }
......
...@@ -149,7 +149,7 @@ enum fid_source { ...@@ -149,7 +149,7 @@ enum fid_source {
struct p9_fid { struct p9_fid {
struct p9_client *clnt; struct p9_client *clnt;
u32 fid; u32 fid;
atomic_t count; refcount_t count;
int mode; int mode;
struct p9_qid qid; struct p9_qid qid;
u32 iounit; u32 iounit;
......
...@@ -901,7 +901,7 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt) ...@@ -901,7 +901,7 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
fid->clnt = clnt; fid->clnt = clnt;
fid->rdir = NULL; fid->rdir = NULL;
fid->fid = 0; fid->fid = 0;
atomic_set(&fid->count, 1); refcount_set(&fid->count, 1);
idr_preload(GFP_KERNEL); idr_preload(GFP_KERNEL);
spin_lock_irq(&clnt->lock); spin_lock_irq(&clnt->lock);
...@@ -1466,7 +1466,7 @@ int p9_client_clunk(struct p9_fid *fid) ...@@ -1466,7 +1466,7 @@ int p9_client_clunk(struct p9_fid *fid)
dump_stack(); dump_stack();
return 0; return 0;
} }
if (!atomic_dec_and_test(&fid->count)) if (!refcount_dec_and_test(&fid->count))
return 0; return 0;
again: again:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment