Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
ace9fad4
Commit
ace9fad4
authored
Sep 02, 2018
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSv4: Convert struct nfs4_state to use refcount_t
Signed-off-by:
Trond Myklebust
<
trond.myklebust@hammerspace.com
>
parent
9ae075fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
fs/nfs/nfs4_fs.h
fs/nfs/nfs4_fs.h
+1
-1
fs/nfs/nfs4proc.c
fs/nfs/nfs4proc.c
+4
-4
fs/nfs/nfs4state.c
fs/nfs/nfs4state.c
+4
-4
No files found.
fs/nfs/nfs4_fs.h
View file @
ace9fad4
...
...
@@ -188,7 +188,7 @@ struct nfs4_state {
unsigned
int
n_wronly
;
/* Number of write-only references */
unsigned
int
n_rdwr
;
/* Number of read/write references */
fmode_t
state
;
/* State on the server (R,W, or RW) */
atomic
_t
count
;
refcount
_t
count
;
wait_queue_head_t
waitq
;
struct
rcu_head
rcu_head
;
...
...
fs/nfs/nfs4proc.c
View file @
ace9fad4
...
...
@@ -1777,7 +1777,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)
out:
return
ERR_PTR
(
ret
);
out_return_state:
atomic
_inc
(
&
state
->
count
);
refcount
_inc
(
&
state
->
count
);
return
state
;
}
...
...
@@ -1849,7 +1849,7 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
update:
update_open_stateid
(
state
,
&
data
->
o_res
.
stateid
,
NULL
,
data
->
o_arg
.
fmode
);
atomic
_inc
(
&
state
->
count
);
refcount
_inc
(
&
state
->
count
);
return
state
;
}
...
...
@@ -1887,7 +1887,7 @@ nfs4_opendata_find_nfs4_state(struct nfs4_opendata *data)
return
ERR_CAST
(
inode
);
if
(
data
->
state
!=
NULL
&&
data
->
state
->
inode
==
inode
)
{
state
=
data
->
state
;
atomic
_inc
(
&
state
->
count
);
refcount
_inc
(
&
state
->
count
);
}
else
state
=
nfs4_get_open_state
(
inode
,
data
->
owner
);
iput
(
inode
);
...
...
@@ -1978,7 +1978,7 @@ static struct nfs4_opendata *nfs4_open_recoverdata_alloc(struct nfs_open_context
if
(
opendata
==
NULL
)
return
ERR_PTR
(
-
ENOMEM
);
opendata
->
state
=
state
;
atomic
_inc
(
&
state
->
count
);
refcount
_inc
(
&
state
->
count
);
return
opendata
;
}
...
...
fs/nfs/nfs4state.c
View file @
ace9fad4
...
...
@@ -655,7 +655,7 @@ nfs4_alloc_open_state(void)
state
=
kzalloc
(
sizeof
(
*
state
),
GFP_NOFS
);
if
(
!
state
)
return
NULL
;
atomic
_set
(
&
state
->
count
,
1
);
refcount
_set
(
&
state
->
count
,
1
);
INIT_LIST_HEAD
(
&
state
->
lock_states
);
spin_lock_init
(
&
state
->
state_lock
);
seqlock_init
(
&
state
->
seqlock
);
...
...
@@ -689,7 +689,7 @@ __nfs4_find_state_byowner(struct inode *inode, struct nfs4_state_owner *owner)
continue
;
if
(
!
nfs4_valid_open_stateid
(
state
))
continue
;
if
(
atomic
_inc_not_zero
(
&
state
->
count
))
if
(
refcount
_inc_not_zero
(
&
state
->
count
))
return
state
;
}
return
NULL
;
...
...
@@ -743,7 +743,7 @@ void nfs4_put_open_state(struct nfs4_state *state)
struct
inode
*
inode
=
state
->
inode
;
struct
nfs4_state_owner
*
owner
=
state
->
owner
;
if
(
!
atomic
_dec_and_lock
(
&
state
->
count
,
&
owner
->
so_lock
))
if
(
!
refcount
_dec_and_lock
(
&
state
->
count
,
&
owner
->
so_lock
))
return
;
spin_lock
(
&
inode
->
i_lock
);
list_del_rcu
(
&
state
->
inode_states
);
...
...
@@ -1573,7 +1573,7 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs
continue
;
if
(
state
->
state
==
0
)
continue
;
atomic
_inc
(
&
state
->
count
);
refcount
_inc
(
&
state
->
count
);
spin_unlock
(
&
sp
->
so_lock
);
status
=
ops
->
recover_open
(
sp
,
state
);
if
(
status
>=
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment