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>
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 79a2871..9841543 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1818,12 +1818,10 @@
static struct rtable *rt_dst_alloc(bool nopolicy, bool noxfrm)
{
- struct rtable *rt = dst_alloc(&ipv4_dst_ops);
+ struct rtable *rt = dst_alloc(&ipv4_dst_ops, 1);
if (rt) {
rt->dst.obsolete = -1;
- atomic_set(&rt->dst.__refcnt, 1);
-
rt->dst.flags = DST_HOST |
(nopolicy ? DST_NOPOLICY : 0) |
(noxfrm ? DST_NOXFRM : 0);
@@ -2679,12 +2677,11 @@
{
struct rtable *ort = *rp;
struct rtable *rt = (struct rtable *)
- dst_alloc(&ipv4_dst_blackhole_ops);
+ dst_alloc(&ipv4_dst_blackhole_ops, 1);
if (rt) {
struct dst_entry *new = &rt->dst;
- atomic_set(&new->__refcnt, 1);
new->__use = 1;
new->input = dst_discard;
new->output = dst_discard;