From: Ben Pfaff Date: Wed, 9 Dec 2009 21:29:02 +0000 (-0800) Subject: ovs-vsctl: Fix performance problem. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=586bb84a49efa62a56e9aed2a345e01679dcccca;p=openvswitch ovs-vsctl: Fix performance problem. --- diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 9bb12014..e0c54064 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 cfc729ef..5915a1bb 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 1f697b4f..4f44afe8 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 d94308ca..0f6abf32 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);