aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_transaction.c
diff options
context:
space:
mode:
authorvhanquez@gwig.uk.xensource.com <vhanquez@gwig.uk.xensource.com>2006-07-31 09:30:36 +0000
committervhanquez@gwig.uk.xensource.com <vhanquez@gwig.uk.xensource.com>2006-07-31 09:30:36 +0000
commit8d79f14a5d89af02c8a9dd3710228c4d7c20b237 (patch)
tree1fb2880f075b0e26b6431a5090620e884c00a932 /tools/xenstore/xenstored_transaction.c
parentd763fcc1635f3dfc4af6da15a3f329cbe0e3e14e (diff)
downloadxen-8d79f14a5d89af02c8a9dd3710228c4d7c20b237.tar.gz
xen-8d79f14a5d89af02c8a9dd3710228c4d7c20b237.tar.bz2
xen-8d79f14a5d89af02c8a9dd3710228c4d7c20b237.zip
Add a transaction_started field in xenstored connection structure instead of
browsing the list of transaction each time Bump the default to 10, and make it configurable through the command line. Signed-off-by: Vincent Hanquez <vincent@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_transaction.c')
-rw-r--r--tools/xenstore/xenstored_transaction.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.c
index a3f2157256..fb20287f99 100644
--- a/tools/xenstore/xenstored_transaction.c
+++ b/tools/xenstore/xenstored_transaction.c
@@ -66,6 +66,7 @@ struct transaction
struct list_head changes;
};
+extern int quota_max_transaction;
static unsigned int generation;
/* Return tdb context to use for this connection. */
@@ -125,7 +126,6 @@ void do_transaction_start(struct connection *conn, struct buffered_data *in)
{
struct transaction *trans, *exists;
char id_str[20];
- int started;
/* We don't support nested transactions. */
if (conn->transaction) {
@@ -133,11 +133,7 @@ void do_transaction_start(struct connection *conn, struct buffered_data *in)
return;
}
- started = 0;
- list_for_each_entry(trans, &conn->transaction_list, list)
- started++;
-
- if (started > 5) {
+ if (conn->transaction_started > quota_max_transaction) {
send_error(conn, ENOSPC);
return;
}
@@ -166,6 +162,7 @@ void do_transaction_start(struct connection *conn, struct buffered_data *in)
list_add_tail(&trans->list, &conn->transaction_list);
talloc_steal(conn, trans);
talloc_set_destructor(trans, destroy_transaction);
+ conn->transaction_started++;
sprintf(id_str, "%u", trans->id);
send_reply(conn, XS_TRANSACTION_START, id_str, strlen(id_str)+1);
@@ -188,6 +185,7 @@ void do_transaction_end(struct connection *conn, const char *arg)
conn->transaction = NULL;
list_del(&trans->list);
+ conn->transaction_started--;
/* Attach transaction to arg for auto-cleanup */
talloc_steal(arg, trans);