Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78378
b: refs/heads/master
c: a2bbe68
h: refs/heads/master
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Jan 28, 2008
1 parent d032aec commit 903b55e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c17860a039bbde134324ad6f9331500635f5799d
refs/heads/master: a2bbe6822f8928e254452765c07cb863633113b8
19 changes: 4 additions & 15 deletions trunk/net/ipv4/fib_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,7 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib
break;
} else if (!fib_detect_death(fi, order, &last_resort,
&last_idx, fn_hash_last_dflt)) {
if (res->fi)
fib_info_put(res->fi);
res->fi = fi;
atomic_inc(&fi->fib_clntref);
fib_result_assign(res, fi);
fn_hash_last_dflt = order;
goto out;
}
Expand All @@ -333,21 +330,13 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib
}

if (!fib_detect_death(fi, order, &last_resort, &last_idx, fn_hash_last_dflt)) {
if (res->fi)
fib_info_put(res->fi);
res->fi = fi;
atomic_inc(&fi->fib_clntref);
fib_result_assign(res, fi);
fn_hash_last_dflt = order;
goto out;
}

if (last_idx >= 0) {
if (res->fi)
fib_info_put(res->fi);
res->fi = last_resort;
if (last_resort)
atomic_inc(&last_resort->fib_clntref);
}
if (last_idx >= 0)
fib_result_assign(res, last_resort);
fn_hash_last_dflt = last_idx;
out:
read_unlock(&fib_hash_lock);
Expand Down
10 changes: 10 additions & 0 deletions trunk/net/ipv4/fib_lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ extern int fib_detect_death(struct fib_info *fi, int order,
struct fib_info **last_resort,
int *last_idx, int dflt);

static inline void fib_result_assign(struct fib_result *res,
struct fib_info *fi)
{
if (res->fi != NULL)
fib_info_put(res->fi);
res->fi = fi;
if (fi != NULL)
atomic_inc(&fi->fib_clntref);
}

#endif /* _FIB_LOOKUP_H */
19 changes: 4 additions & 15 deletions trunk/net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -1831,10 +1831,7 @@ fn_trie_select_default(struct fib_table *tb, const struct flowi *flp, struct fib
break;
} else if (!fib_detect_death(fi, order, &last_resort,
&last_idx, trie_last_dflt)) {
if (res->fi)
fib_info_put(res->fi);
res->fi = fi;
atomic_inc(&fi->fib_clntref);
fib_result_assign(res, fi);
trie_last_dflt = order;
goto out;
}
Expand All @@ -1847,20 +1844,12 @@ fn_trie_select_default(struct fib_table *tb, const struct flowi *flp, struct fib
}

if (!fib_detect_death(fi, order, &last_resort, &last_idx, trie_last_dflt)) {
if (res->fi)
fib_info_put(res->fi);
res->fi = fi;
atomic_inc(&fi->fib_clntref);
fib_result_assign(res, fi);
trie_last_dflt = order;
goto out;
}
if (last_idx >= 0) {
if (res->fi)
fib_info_put(res->fi);
res->fi = last_resort;
if (last_resort)
atomic_inc(&last_resort->fib_clntref);
}
if (last_idx >= 0)
fib_result_assign(res, last_resort);
trie_last_dflt = last_idx;
out:;
rcu_read_unlock();
Expand Down

0 comments on commit 903b55e

Please sign in to comment.