summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-09-11 11:12:03 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-09-11 11:12:03 -0400
commitc9abf5584a4691818b4c76e59d569e67fb34314e (patch)
tree6c0c61a23038ece95adb70ac8554560ba3518f25
parent953d97fc4aef0c7715e8d42d7d52ebc18d873ac6 (diff)
zebra: Small performance improvement for garbage collection
There is no need to retrieve the zvrf *unless* we are doing debugs. So move the retrieval under the debug statement. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--zebra/zebra_rib.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index c4c80b156b..9dc0630c8c 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1118,7 +1118,6 @@ static int rib_can_delete_dest(rib_dest_t *dest)
int rib_gc_dest(struct route_node *rn)
{
rib_dest_t *dest;
- struct zebra_vrf *zvrf;
dest = rib_dest_from_rnode(rn);
if (!dest)
@@ -1127,9 +1126,12 @@ int rib_gc_dest(struct route_node *rn)
if (!rib_can_delete_dest(dest))
return 0;
- zvrf = rib_dest_vrf(dest);
- if (IS_ZEBRA_DEBUG_RIB)
+ if (IS_ZEBRA_DEBUG_RIB) {
+ struct zebra_vrf *zvrf;
+
+ zvrf = rib_dest_vrf(dest);
rnode_debug(rn, zvrf_id(zvrf), "removing dest from table");
+ }
dest->rnode = NULL;
XFREE(MTYPE_RIB_DEST, dest);