Btrfs: early reference counting

Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/random-test.c b/fs/btrfs/random-test.c
index 53245c50..dcc852a 100644
--- a/fs/btrfs/random-test.c
+++ b/fs/btrfs/random-test.c
@@ -93,7 +93,7 @@
 	ret = setup_key(radix, &key, 1);
 	if (ret < 0)
 		return 0;
-	ret = search_slot(root, &key, &path, -1);
+	ret = search_slot(root, &key, &path, -1, 1);
 	if (ret)
 		goto error;
 	ret = del_item(root, &path);
@@ -118,7 +118,7 @@
 	ret = setup_key(radix, &key, 1);
 	if (ret < 0)
 		return 0;
-	ret = search_slot(root, &key, &path, 0);
+	ret = search_slot(root, &key, &path, 0, 1);
 	release_path(root, &path);
 	if (ret)
 		goto error;
@@ -137,7 +137,7 @@
 	ret = setup_key(radix, &key, 0);
 	if (ret < 0)
 		return ret;
-	ret = search_slot(root, &key, &path, 0);
+	ret = search_slot(root, &key, &path, 0, 0);
 	release_path(root, &path);
 	if (ret <= 0)
 		goto error;
@@ -163,7 +163,7 @@
 	key.objectid = (unsigned long)-1;
 	while(nr-- >= 0) {
 		init_path(&path);
-		ret = search_slot(root, &key, &path, -1);
+		ret = search_slot(root, &key, &path, -1, 1);
 		if (ret < 0) {
 			release_path(root, &path);
 			return ret;
@@ -216,7 +216,7 @@
 				return ret;
 			}
 		}
-		if (i % 10000 == 0) {
+		if (i && i % 10000 == 0) {
 			printf("bigfill %d\n", i);
 		}
 		if (!keep_running)
@@ -263,7 +263,7 @@
 	key.objectid = (unsigned long)-1;
 	while(1) {
 		init_path(&path);
-		ret = search_slot(root, &key, &path, 0);
+		ret = search_slot(root, &key, &path, 0, 0);
 		if (ret < 0) {
 			release_path(root, &path);
 			return ret;