>From e7623970cd71f8af7c3849a5beff87fd31fbdf68 Mon Sep 17 00:00:00 2001
From: Sha Zhang <zhangsha.zh...@huawei.com>
Date: Tue, 17 Jan 2017 11:34:24 +0800
Subject: [PATCH] ofproto-dpif: Reduce the time of creating large mount of
bridges

This patch moves function xlate_txn_start and xlate_txn_commit out of the loop
traversing all the ofproto-dpifs to reduce the time of creating a large mount
of bridges in separate database transactions.
As a global variable, new_xcfg should only be allocated at the beginning and
commited at the end once time, other than doing it repeatly in the loop body.

Signed-off-by: Sha Zhang <zhangsha.zh...@huawei.com>
---
ofproto/ofproto-dpif.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 72e91b9..9cb8472 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -432,6 +432,7 @@ type_run(const char *type)
         }
         backer->need_revalidate = 0;
+        xlate_txn_start();
         HMAP_FOR_EACH (ofproto, all_ofproto_dpifs_node, &all_ofproto_dpifs) {
             struct ofport_dpif *ofport;
             struct ofbundle *bundle;
@@ -440,7 +441,6 @@ type_run(const char *type)
                 continue;
             }
-            xlate_txn_start();
             xlate_ofproto_set(ofproto, ofproto->up.name,
                               ofproto->backer->dpif, ofproto->ml,
                               ofproto->stp, ofproto->rstp, ofproto->ms,
@@ -471,9 +471,9 @@ type_run(const char *type)
                                  ofport->up.pp.state, ofport->is_tunnel,
                                  ofport->may_enable);
             }
-            xlate_txn_commit();
         }
+        xlate_txn_commit();
         udpif_revalidate(backer->udpif);
     }
--
1.8.3.1
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to