From: Ben Pfaff Date: Wed, 9 Dec 2009 21:29:02 +0000 (-0800) Subject: ovs-vsctl: Fix performance problem. X-Git-Tag: v1.0.0~259^2~433 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=586bb84a49efa62a56e9aed2a345e01679dcccca;p=sliver-openvswitch.git ovs-vsctl: Fix performance problem. --- diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 9bb120140..e0c540641 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -28,6 +28,7 @@ #include "ovsdb-data.h" #include "ovsdb-error.h" #include "ovsdb-idl-provider.h" +#include "poll-loop.h" #include "shash.h" #include "util.h" @@ -800,6 +801,14 @@ ovsdb_idl_txn_destroy(struct ovsdb_idl_txn *txn) free(txn); } +void +ovsdb_idl_txn_wait(const struct ovsdb_idl_txn *txn) +{ + if (txn->status != TXN_INCOMPLETE) { + poll_immediate_wake(); + } +} + static struct json * where_uuid_equals(const struct uuid *uuid) { diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h index cfc729ef7..5915a1bb9 100644 --- a/lib/ovsdb-idl.h +++ b/lib/ovsdb-idl.h @@ -42,6 +42,7 @@ const char *ovsdb_idl_txn_status_to_string(enum ovsdb_idl_txn_status); struct ovsdb_idl_txn *ovsdb_idl_txn_create(struct ovsdb_idl *); void ovsdb_idl_txn_destroy(struct ovsdb_idl_txn *); +void ovsdb_idl_txn_wait(const struct ovsdb_idl_txn *); enum ovsdb_idl_txn_status ovsdb_idl_txn_commit(struct ovsdb_idl_txn *); void ovsdb_idl_txn_abort(struct ovsdb_idl_txn *); diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index 1f697b4fc..4f44afe86 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -1479,6 +1479,7 @@ idl_set(struct ovsdb_idl *idl, char *commands, int step) while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) { ovsdb_idl_run(idl); ovsdb_idl_wait(idl); + ovsdb_idl_txn_wait(txn); poll_block(); } printf("%03d: commit, status=%s\n", diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index d94308ca6..0f6abf321 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -954,6 +954,7 @@ do_vsctl(int argc, char *argv[], struct ovsdb_idl *idl) while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) { ovsdb_idl_run(idl); ovsdb_idl_wait(idl); + ovsdb_idl_txn_wait(txn); poll_block(); } ovsdb_idl_txn_destroy(txn);