summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/random-test.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-06 20:08:01 -0500
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-06 20:08:01 -0500
commita28ec19775d62d673b034082128aca95780d3737 (patch)
tree105694ca29ed0ad6563c45a86df9a7df1abf94ff /fs/btrfs/random-test.c
parent02217ed299c6340a35696e0610047eb96826de2d (diff)
downloadtalos-obmc-linux-a28ec19775d62d673b034082128aca95780d3737.tar.gz
talos-obmc-linux-a28ec19775d62d673b034082128aca95780d3737.zip
Btrfs: Fixup reference counting on cows
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/random-test.c')
-rw-r--r--fs/btrfs/random-test.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/btrfs/random-test.c b/fs/btrfs/random-test.c
index dcc852ad6737..7b37b6bae105 100644
--- a/fs/btrfs/random-test.c
+++ b/fs/btrfs/random-test.c
@@ -8,6 +8,7 @@
#include "print-tree.h"
int keep_running = 1;
+struct ctree_super_block super;
static int setup_key(struct radix_tree_root *root, struct key *key, int exists)
{
@@ -59,11 +60,6 @@ error:
return -1;
}
-static int run_commit(struct ctree_root *root, struct radix_tree_root *radix)
-{
- return commit_transaction(root);
-}
-
static int insert_dup(struct ctree_root *root, struct radix_tree_root *radix)
{
struct ctree_path path;
@@ -210,7 +206,7 @@ static int fill_tree(struct ctree_root *root, struct radix_tree_root *radix,
goto out;
}
if (i % 1000 == 0) {
- ret = commit_transaction(root);
+ ret = commit_transaction(root, &super);
if (ret) {
fprintf(stderr, "fill commit failed\n");
return ret;
@@ -229,7 +225,7 @@ out:
static int bulk_op(struct ctree_root *root, struct radix_tree_root *radix)
{
int ret;
- int nr = rand() % 20000;
+ int nr = rand() % 5000;
static int run_nr = 0;
/* do the bulk op much less frequently */
@@ -247,7 +243,7 @@ static int bulk_op(struct ctree_root *root, struct radix_tree_root *radix)
int (*ops[])(struct ctree_root *root, struct radix_tree_root *radix) =
{ ins_one, insert_dup, del_one, lookup_item,
- lookup_enoent, bulk_op, run_commit };
+ lookup_enoent, bulk_op };
static int fill_radix(struct ctree_root *root, struct radix_tree_root *radix)
{
@@ -314,7 +310,6 @@ int print_usage(void)
int main(int ac, char **av)
{
RADIX_TREE(radix, GFP_KERNEL);
- struct ctree_super_block super;
struct ctree_root *root;
int i;
int ret;
@@ -365,8 +360,7 @@ int main(int ac, char **av)
printf("open & close, root level %d nritems %d\n",
node_level(root->node->node.header.flags),
root->node->node.header.nritems);
- write_ctree_super(root, &super);
- close_ctree(root);
+ close_ctree(root, &super);
root = open_ctree("dbfile", &super);
}
while(count--) {
@@ -380,7 +374,7 @@ int main(int ac, char **av)
err = ret;
goto out;
}
- if (ops[op] == bulk_op || ops[op] == run_commit)
+ if (ops[op] == bulk_op)
break;
if (keep_running == 0) {
err = 0;
@@ -389,8 +383,7 @@ int main(int ac, char **av)
}
}
out:
- write_ctree_super(root, &super);
- close_ctree(root);
+ close_ctree(root, &super);
return err;
}
OpenPOWER on IntegriCloud