aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-02-16 17:08:44 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-17 18:44:00 -0500
commit3c7bd1a14071b99d6535b710bc998ae5d3abbb66 (patch)
tree05f31758aa4d6b49b70a4af4a8df4a83588610c2 /net/ipv6/route.c
parent0c4dcd58fd69aded93b0dc6917cd88b262c8aa3f (diff)
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/ipv6/route.c')
-rw-r--r--net/ipv6/route.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ad8556e6fd41..7946b53692da 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -221,7 +221,7 @@ static struct rt6_info ip6_blk_hole_entry_template = {
221/* allocate dst with ip6_dst_ops */ 221/* allocate dst with ip6_dst_ops */
222static inline struct rt6_info *ip6_dst_alloc(struct dst_ops *ops) 222static inline struct rt6_info *ip6_dst_alloc(struct dst_ops *ops)
223{ 223{
224 return (struct rt6_info *)dst_alloc(ops); 224 return (struct rt6_info *)dst_alloc(ops, 0);
225} 225}
226 226
227static void ip6_dst_destroy(struct dst_entry *dst) 227static void ip6_dst_destroy(struct dst_entry *dst)
@@ -873,13 +873,12 @@ int ip6_dst_blackhole(struct sock *sk, struct dst_entry **dstp, struct flowi *fl
873{ 873{
874 struct rt6_info *ort = (struct rt6_info *) *dstp; 874 struct rt6_info *ort = (struct rt6_info *) *dstp;
875 struct rt6_info *rt = (struct rt6_info *) 875 struct rt6_info *rt = (struct rt6_info *)
876 dst_alloc(&ip6_dst_blackhole_ops); 876 dst_alloc(&ip6_dst_blackhole_ops, 1);
877 struct dst_entry *new = NULL; 877 struct dst_entry *new = NULL;
878 878
879 if (rt) { 879 if (rt) {
880 new = &rt->dst; 880 new = &rt->dst;
881 881
882 atomic_set(&new->__refcnt, 1);
883 new->__use = 1; 882 new->__use = 1;
884 new->input = dst_discard; 883 new->input = dst_discard;
885 new->output = dst_discard; 884 new->output = dst_discard;