summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHerbert Xu2006-02-22 23:47:13 +0100
committerDavid S. Miller2006-02-24 01:10:53 +0100
commit21380b81ef8699179b535e197a95b891a7badac7 (patch)
tree1a6be9864cabbed59db6357b2f0244413acac4c4 /include
parent[IPV4]: Fix garbage collection of multipath route entries (diff)
downloadkernel-qcow2-linux-21380b81ef8699179b535e197a95b891a7badac7.tar.gz
kernel-qcow2-linux-21380b81ef8699179b535e197a95b891a7badac7.tar.xz
kernel-qcow2-linux-21380b81ef8699179b535e197a95b891a7badac7.zip
[XFRM]: Eliminate refcounting confusion by creating __xfrm_state_put().
We often just do an atomic_dec(&x->refcnt) on an xfrm_state object because we know there is more than 1 reference remaining and thus we can elide the heavier xfrm_state_put() call. Do this behind an inline function called __xfrm_state_put() so that is more obvious and also to allow us to more cleanly add refcount debugging later. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/xfrm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d6111a2f0a23..004e645f3e18 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -403,6 +403,11 @@ unsigned xfrm_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto, unsigned short f
extern void __xfrm_state_destroy(struct xfrm_state *);
+static inline void __xfrm_state_put(struct xfrm_state *x)
+{
+ atomic_dec(&x->refcnt);
+}
+
static inline void xfrm_state_put(struct xfrm_state *x)
{
if (atomic_dec_and_test(&x->refcnt))