diff options
| author | Eric Dumazet <edumazet@google.com> | 2024-12-15 17:56:27 +0000 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2024-12-17 19:37:00 -0800 |
| commit | 7a596a50c4a4eab946aec149171c72321b4934aa (patch) | |
| tree | 2e912348410916ad1a072037c54438ada50479f8 /net | |
| parent | 661cd8fc8e9039819ca0c22e0add52b632240a9e (diff) | |
| download | linux-next-7a596a50c4a4eab946aec149171c72321b4934aa.tar.gz linux-next-7a596a50c4a4eab946aec149171c72321b4934aa.zip | |
inetpeer: remove create argument of inet_getpeer()
All callers of inet_getpeer() want to create an inetpeer.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241215175629.1248773-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv4/inetpeer.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index 5ab56f4cb529..bc79cc9d13eb 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c @@ -169,13 +169,11 @@ static void inet_peer_gc(struct inet_peer_base *base, } struct inet_peer *inet_getpeer(struct inet_peer_base *base, - const struct inetpeer_addr *daddr, - int create) + const struct inetpeer_addr *daddr) { struct inet_peer *p, *gc_stack[PEER_MAX_GC]; struct rb_node **pp, *parent; unsigned int gc_cnt, seq; - int invalidated; /* Attempt a lockless lookup first. * Because of a concurrent writer, we might not find an existing entry. @@ -183,16 +181,11 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, rcu_read_lock(); seq = read_seqbegin(&base->lock); p = lookup(daddr, base, seq, NULL, &gc_cnt, &parent, &pp); - invalidated = read_seqretry(&base->lock, seq); rcu_read_unlock(); if (p) return p; - /* If no writer did a change during our lookup, we can return early. */ - if (!create && !invalidated) - return NULL; - /* retry an exact lookup, taking the lock before. * At least, nodes should be hot in our cache. */ @@ -201,7 +194,7 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, gc_cnt = 0; p = lookup(daddr, base, seq, gc_stack, &gc_cnt, &parent, &pp); - if (!p && create) { + if (!p) { p = kmem_cache_alloc(peer_cachep, GFP_ATOMIC); if (p) { p->daddr = *daddr; |
