aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svc_xprt.c
diff options
context:
space:
mode:
authorTom Tucker <tom@opengridcomputing.com>2007-12-30 22:07:46 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-02-01 16:42:11 -0500
commite1b3157f9710622bad6c7747d3b08ed3d2394cf6 (patch)
treee03687e0363fdb2307f7e4909a735e8d1331050a /net/sunrpc/svc_xprt.c
parentd7c9f1ed972b4a468dd24a2457721704dfe9ca70 (diff)
svc: Change sk_inuse to a kref
Change the atomic_t reference count to a kref and move it to the transport indepenent svc_xprt structure. Change the reference count wrapper names to be generic. Signed-off-by: Tom Tucker <tom@opengridcomputing.com> Acked-by: Neil Brown <neilb@suse.de> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Greg Banks <gnb@sgi.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r--net/sunrpc/svc_xprt.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 6ff5ca71602f..31853bfcd88d 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -70,6 +70,21 @@ void svc_unreg_xprt_class(struct svc_xprt_class *xcl)
70} 70}
71EXPORT_SYMBOL_GPL(svc_unreg_xprt_class); 71EXPORT_SYMBOL_GPL(svc_unreg_xprt_class);
72 72
73static void svc_xprt_free(struct kref *kref)
74{
75 struct svc_xprt *xprt =
76 container_of(kref, struct svc_xprt, xpt_ref);
77 struct module *owner = xprt->xpt_class->xcl_owner;
78 xprt->xpt_ops->xpo_free(xprt);
79 module_put(owner);
80}
81
82void svc_xprt_put(struct svc_xprt *xprt)
83{
84 kref_put(&xprt->xpt_ref, svc_xprt_free);
85}
86EXPORT_SYMBOL_GPL(svc_xprt_put);
87
73/* 88/*
74 * Called by transport drivers to initialize the transport independent 89 * Called by transport drivers to initialize the transport independent
75 * portion of the transport instance. 90 * portion of the transport instance.
@@ -79,6 +94,7 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt)
79 memset(xprt, 0, sizeof(*xprt)); 94 memset(xprt, 0, sizeof(*xprt));
80 xprt->xpt_class = xcl; 95 xprt->xpt_class = xcl;
81 xprt->xpt_ops = xcl->xcl_ops; 96 xprt->xpt_ops = xcl->xcl_ops;
97 kref_init(&xprt->xpt_ref);
82} 98}
83EXPORT_SYMBOL_GPL(svc_xprt_init); 99EXPORT_SYMBOL_GPL(svc_xprt_init);
84 100