From c9abf5584a4691818b4c76e59d569e67fb34314e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 11 Sep 2017 11:12:03 -0400 Subject: [PATCH] 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 --- zebra/zebra_rib.c | 8 +++++--- 1 file 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);