diff options
author | emellor@ewan <emellor@ewan> | 2005-09-23 14:28:16 +0100 |
---|---|---|
committer | emellor@ewan <emellor@ewan> | 2005-09-23 14:28:16 +0100 |
commit | bdd477ad345e8e0ba6640ea480fa47a7c3d5fdf0 (patch) | |
tree | e8fc323b3f0330ac42ee57f9cc8bb740baabcc9f /tools/xenstore | |
parent | f11f68cd1157d84615621edcd7321a6d0a09b158 (diff) | |
download | xen-bdd477ad345e8e0ba6640ea480fa47a7c3d5fdf0.tar.gz xen-bdd477ad345e8e0ba6640ea480fa47a7c3d5fdf0.tar.bz2 xen-bdd477ad345e8e0ba6640ea480fa47a7c3d5fdf0.zip |
Add check for speed (takes 33 minutes on my laptop, OUCH!)
Make xenstored use tdb, transactions can soft-fail (EAGAIN)
Transactions no longer take root dir, no longer lock & block: commit can fail spuriously with EAGAIN, not ETIMEDOUT.
Speeds up transactions by over 1000 times, should be NFS safe.
New program: xs_tdb_dump to dump raw TDB contents.
Don't do failure testing: we are no longer robust against all ENOMEM 8(
Introduce "struct node" which contains perms, children and data.
Make struct xs_permissions unpadded, so we can write to tdb w/o valgrind complaints.
Gently modify TDB to use talloc, not do alloc on tdb_delete.
Fix up transaction users for new semantics.
Don't need a transaction around a single read in xen/i386/kernel/smpboot.c.
Python: transaction_start() returns True/False rather than raising exception on EAGAIN.
Fix usage comment on xs_transaction_end().
Include stdarg to xs_tdb_dump so it compiles.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'tools/xenstore')
-rw-r--r-- | tools/xenstore/xenstore_client.c | 11 | ||||
-rw-r--r-- | tools/xenstore/xs.h | 4 | ||||
-rw-r--r-- | tools/xenstore/xs_tdb_dump.c | 1 |
3 files changed, 10 insertions, 6 deletions
diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c index 8b6ed4a245..ef428f9acb 100644 --- a/tools/xenstore/xenstore_client.c +++ b/tools/xenstore/xenstore_client.c @@ -14,6 +14,7 @@ #include <stdlib.h> #include <string.h> #include <xs.h> +#include <errno.h> static void usage(const char *progname) @@ -82,8 +83,8 @@ main(int argc, char **argv) } #endif - /* XXX maybe find longest common prefix */ - success = xs_transaction_start(xsh, "/"); + again: + success = xs_transaction_start(xsh); if (!success) errx(1, "couldn't start transaction"); @@ -145,8 +146,10 @@ main(int argc, char **argv) out: success = xs_transaction_end(xsh, ret ? true : false); - if (!success) + if (!success) { + if (ret == 0 && errno == EAGAIN) + goto again; errx(1, "couldn't end transaction"); - + } return ret; } diff --git a/tools/xenstore/xs.h b/tools/xenstore/xs.h index 96d57cde5d..bd4bcbd348 100644 --- a/tools/xenstore/xs.h +++ b/tools/xenstore/xs.h @@ -116,8 +116,8 @@ bool xs_transaction_start(struct xs_handle *h); /* End a transaction. * If abandon is true, transaction is discarded instead of committed. - * Returns false on failure, which indicates an error: transactions will - * not fail spuriously. + * Returns false on failure: if errno == EAGAIN, you have to restart + * transaction. */ bool xs_transaction_end(struct xs_handle *h, bool abort); diff --git a/tools/xenstore/xs_tdb_dump.c b/tools/xenstore/xs_tdb_dump.c index 1cab37ed6d..a68f19fc2b 100644 --- a/tools/xenstore/xs_tdb_dump.c +++ b/tools/xenstore/xs_tdb_dump.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include <fcntl.h> #include <stdio.h> +#include <stdarg.h> #include "xs_lib.h" #include "tdb.h" |