diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-16 17:08:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-17 18:44:00 -0500 |
commit | 3c7bd1a14071b99d6535b710bc998ae5d3abbb66 (patch) | |
tree | 05f31758aa4d6b49b70a4af4a8df4a83588610c2 /net/ipv4 | |
parent | 0c4dcd58fd69aded93b0dc6917cd88b262c8aa3f (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/ipv4')
-rw-r--r-- | net/ipv4/route.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 79a287181025..9841543c468d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1818,12 +1818,10 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1818 | 1818 | ||
1819 | static struct rtable *rt_dst_alloc(bool nopolicy, bool noxfrm) | 1819 | static struct rtable *rt_dst_alloc(bool nopolicy, bool noxfrm) |
1820 | { | 1820 | { |
1821 | struct rtable *rt = dst_alloc(&ipv4_dst_ops); | 1821 | struct rtable *rt = dst_alloc(&ipv4_dst_ops, 1); |
1822 | if (rt) { | 1822 | if (rt) { |
1823 | rt->dst.obsolete = -1; | 1823 | rt->dst.obsolete = -1; |
1824 | 1824 | ||
1825 | atomic_set(&rt->dst.__refcnt, 1); | ||
1826 | |||
1827 | rt->dst.flags = DST_HOST | | 1825 | rt->dst.flags = DST_HOST | |
1828 | (nopolicy ? DST_NOPOLICY : 0) | | 1826 | (nopolicy ? DST_NOPOLICY : 0) | |
1829 | (noxfrm ? DST_NOXFRM : 0); | 1827 | (noxfrm ? DST_NOXFRM : 0); |
@@ -2679,12 +2677,11 @@ static int ipv4_dst_blackhole(struct net *net, struct rtable **rp, struct flowi | |||
2679 | { | 2677 | { |
2680 | struct rtable *ort = *rp; | 2678 | struct rtable *ort = *rp; |
2681 | struct rtable *rt = (struct rtable *) | 2679 | struct rtable *rt = (struct rtable *) |
2682 | dst_alloc(&ipv4_dst_blackhole_ops); | 2680 | dst_alloc(&ipv4_dst_blackhole_ops, 1); |
2683 | 2681 | ||
2684 | if (rt) { | 2682 | if (rt) { |
2685 | struct dst_entry *new = &rt->dst; | 2683 | struct dst_entry *new = &rt->dst; |
2686 | 2684 | ||
2687 | atomic_set(&new->__refcnt, 1); | ||
2688 | new->__use = 1; | 2685 | new->__use = 1; |
2689 | new->input = dst_discard; | 2686 | new->input = dst_discard; |
2690 | new->output = dst_discard; | 2687 | new->output = dst_discard; |