Btrfs: period commit during initial fill in the random tester
authorChris Mason <chris.mason@oracle.com>
Fri, 2 Mar 2007 15:06:43 +0000 (10:06 -0500)
committerDavid Woodhouse <dwmw2@hera.kernel.org>
Fri, 2 Mar 2007 15:06:43 +0000 (10:06 -0500)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/disk-io.c
fs/btrfs/random-test.c

index f7ca5362291ee4c50319f24bcfccd6dc4c3d8cc5..b1a8149bbc842f744942ab9c1ccb234f04afed6e 100644 (file)
@@ -11,7 +11,6 @@
 #include "disk-io.h"
 
 static int allocated_blocks = 0;
-int cache_size = 0;
 int cache_max = 10000;
 
 static int check_tree_block(struct ctree_root *root, struct tree_buffer *buf)
@@ -36,7 +35,7 @@ static int free_some_buffers(struct ctree_root *root)
                        list_del_init(&b->cache);
                        tree_block_release(root, b);
                        if (root->cache_size < cache_max)
-                               return 0;
+                               break;
                }
        }
        return 0;
index 22955753c3a76ae52589e445f1be91a3a9482dba..53245c5039dcd93316e0c846469e35ab33b0b47b 100644 (file)
@@ -202,15 +202,23 @@ static int fill_tree(struct ctree_root *root, struct radix_tree_root *radix,
                     int count)
 {
        int i;
-       int err;
        int ret = 0;
        for (i = 0; i < count; i++) {
                ret = ins_one(root, radix);
                if (ret) {
-                       printf("fill failed\n");
-                       err = ret;
+                       fprintf(stderr, "fill failed\n");
                        goto out;
                }
+               if (i % 1000 == 0) {
+                       ret = commit_transaction(root);
+                       if (ret) {
+                               fprintf(stderr, "fill commit failed\n");
+                               return ret;
+                       }
+               }
+               if (i % 10000 == 0) {
+                       printf("bigfill %d\n", i);
+               }
                if (!keep_running)
                        break;
        }