Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 6636b6dcc3db ("9p: add refcount to p9_fid struct")
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>

+8 -10
+4 -6
fs/9p/fid.c
··· 28 28 29 29 static inline void __add_fid(struct dentry *dentry, struct p9_fid *fid) 30 30 { 31 - atomic_set(&fid->count, 1); 32 31 hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata); 33 32 } 34 33 ··· 61 62 } 62 63 } 63 64 if (ret && !IS_ERR(ret)) 64 - atomic_inc(&ret->count); 65 + refcount_inc(&ret->count); 65 66 spin_unlock(&inode->i_lock); 66 67 return ret; 67 68 } ··· 76 77 void v9fs_open_fid_add(struct inode *inode, struct p9_fid *fid) 77 78 { 78 79 spin_lock(&inode->i_lock); 79 - atomic_set(&fid->count, 1); 80 80 hlist_add_head(&fid->ilist, (struct hlist_head *)&inode->i_private); 81 81 spin_unlock(&inode->i_lock); 82 82 } ··· 108 110 hlist_for_each_entry(fid, h, dlist) { 109 111 if (any || uid_eq(fid->uid, uid)) { 110 112 ret = fid; 111 - atomic_inc(&ret->count); 113 + refcount_inc(&ret->count); 112 114 break; 113 115 } 114 116 } ··· 199 201 } 200 202 /* If we are root ourself just return that */ 201 203 if (dentry->d_sb->s_root == dentry) { 202 - atomic_inc(&fid->count); 204 + refcount_inc(&fid->count); 203 205 return fid; 204 206 } 205 207 /* ··· 248 250 fid = ERR_PTR(-ENOENT); 249 251 } else { 250 252 __add_fid(dentry, fid); 251 - atomic_inc(&fid->count); 253 + refcount_inc(&fid->count); 252 254 spin_unlock(&dentry->d_lock); 253 255 } 254 256 }
+1 -1
fs/9p/fid.h
··· 28 28 if (!fid || IS_ERR(fid)) 29 29 return fid; 30 30 31 - nfid = p9_client_walk(fid, 0, NULL, 1); 31 + nfid = clone_fid(fid); 32 32 p9_client_clunk(fid); 33 33 return nfid; 34 34 }
+1 -1
include/net/9p/client.h
··· 149 149 struct p9_fid { 150 150 struct p9_client *clnt; 151 151 u32 fid; 152 - atomic_t count; 152 + refcount_t count; 153 153 int mode; 154 154 struct p9_qid qid; 155 155 u32 iounit;
+2 -2
net/9p/client.c
··· 901 901 fid->clnt = clnt; 902 902 fid->rdir = NULL; 903 903 fid->fid = 0; 904 - atomic_set(&fid->count, 1); 904 + refcount_set(&fid->count, 1); 905 905 906 906 idr_preload(GFP_KERNEL); 907 907 spin_lock_irq(&clnt->lock); ··· 1466 1466 dump_stack(); 1467 1467 return 0; 1468 1468 } 1469 - if (!atomic_dec_and_test(&fid->count)) 1469 + if (!refcount_dec_and_test(&fid->count)) 1470 1470 return 0; 1471 1471 1472 1472 again: