summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-02-17 01:08:44 +0300
committerDavid S. Miller <davem@davemloft.net>2011-02-18 02:44:00 +0300
commit3c7bd1a14071b99d6535b710bc998ae5d3abbb66 (patch)
tree05f31758aa4d6b49b70a4af4a8df4a83588610c2 /net/core
parent0c4dcd58fd69aded93b0dc6917cd88b262c8aa3f (diff)
downloadlinux-3c7bd1a14071b99d6535b710bc998ae5d3abbb66.tar.xz
net: Add initial_ref arg to dst_alloc().
This allows avoiding multiple writes to the initial __refcnt. The most simplest cases of wanting an initial reference of "1" in ipv4 and ipv6 have been converted, the rest have been left along and kept at the existing "0". Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dst.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/dst.c b/net/core/dst.c
index c1674fde827d..91104d35de7d 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(dst_discard);
const u32 dst_default_metrics[RTAX_MAX];
-void *dst_alloc(struct dst_ops *ops)
+void *dst_alloc(struct dst_ops *ops, int initial_ref)
{
struct dst_entry *dst;
@@ -177,7 +177,7 @@ void *dst_alloc(struct dst_ops *ops)
dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC);
if (!dst)
return NULL;
- atomic_set(&dst->__refcnt, 0);
+ atomic_set(&dst->__refcnt, initial_ref);
dst->ops = ops;
dst->lastuse = jiffies;
dst->path = dst;