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
Kirill Smelkov
linux
Commits
a8de240a
Commit
a8de240a
authored
Mar 15, 2011
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SUNRPC: Convert struct rpc_xprt to use atomic_t counters
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
e020c680
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
include/linux/sunrpc/xprt.h
include/linux/sunrpc/xprt.h
+1
-2
net/sunrpc/xprt.c
net/sunrpc/xprt.c
+8
-8
No files found.
include/linux/sunrpc/xprt.h
View file @
a8de240a
...
...
@@ -12,7 +12,6 @@
#include <linux/uio.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/kref.h>
#include <linux/ktime.h>
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/xdr.h>
...
...
@@ -146,7 +145,7 @@ enum xprt_transports {
};
struct
rpc_xprt
{
struct
kref
kref
;
/* Reference count */
atomic_t
count
;
/* Reference count */
struct
rpc_xprt_ops
*
ops
;
/* transport methods */
const
struct
rpc_timeout
*
timeout
;
/* timeout parms */
...
...
net/sunrpc/xprt.c
View file @
a8de240a
...
...
@@ -964,7 +964,7 @@ struct rpc_xprt *xprt_alloc(struct net *net, int size, int max_req)
xprt
=
kzalloc
(
size
,
GFP_KERNEL
);
if
(
xprt
==
NULL
)
goto
out
;
kref_init
(
&
xprt
->
kref
);
atomic_set
(
&
xprt
->
count
,
1
);
xprt
->
max_reqs
=
max_req
;
xprt
->
slot
=
kcalloc
(
max_req
,
sizeof
(
struct
rpc_rqst
),
GFP_KERNEL
);
...
...
@@ -1144,13 +1144,11 @@ struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
/**
* xprt_destroy - destroy an RPC transport, killing off all requests.
* @
kref: kref for the
transport to destroy
* @
xprt:
transport to destroy
*
*/
static
void
xprt_destroy
(
struct
kref
*
kref
)
static
void
xprt_destroy
(
struct
rpc_xprt
*
xprt
)
{
struct
rpc_xprt
*
xprt
=
container_of
(
kref
,
struct
rpc_xprt
,
kref
);
dprintk
(
"RPC: destroying transport %p
\n
"
,
xprt
);
xprt
->
shutdown
=
1
;
del_timer_sync
(
&
xprt
->
timer
);
...
...
@@ -1174,7 +1172,8 @@ static void xprt_destroy(struct kref *kref)
*/
void
xprt_put
(
struct
rpc_xprt
*
xprt
)
{
kref_put
(
&
xprt
->
kref
,
xprt_destroy
);
if
(
atomic_dec_and_test
(
&
xprt
->
count
))
xprt_destroy
(
xprt
);
}
/**
...
...
@@ -1184,6 +1183,7 @@ void xprt_put(struct rpc_xprt *xprt)
*/
struct
rpc_xprt
*
xprt_get
(
struct
rpc_xprt
*
xprt
)
{
kref_get
(
&
xprt
->
kref
);
if
(
atomic_inc_not_zero
(
&
xprt
->
count
))
return
xprt
;
return
NULL
;
}
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