struct btrfs_root *root;
struct btrfs_trans_handle *trans;
- buf = malloc(512);
- memset(buf, 0, 512);
+ buf = calloc(1, 512);
radix_tree_init();
exit(1);
}
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
srand(55);
- btrfs_set_key_type(&ins, BTRFS_STRING_ITEM_KEY);
+ ins.type = BTRFS_STRING_ITEM_KEY;
for (i = 0; i < run_size; i++) {
num = next_key(i, max_key);
// num = i;
if (i == run_size - 5) {
btrfs_commit_transaction(trans, root);
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
}
}
btrfs_commit_transaction(trans, root);
printf("node %p level %d total ptrs %d free spc %lu\n", root->node,
btrfs_header_level(root->node),
btrfs_header_nritems(root->node),
- (unsigned long)BTRFS_NODEPTRS_PER_BLOCK(root) -
+ (unsigned long)BTRFS_NODEPTRS_PER_BLOCK(root->fs_info) -
btrfs_header_nritems(root->node));
printf("all searches good, deleting some items\n");
i = 0;
srand(55);
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
for (i = 0 ; i < run_size/4; i++) {
num = next_key(i, max_key);
ins.objectid = num;
exit(1);
}
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
srand(128);
for (i = 0; i < run_size; i++) {
num = next_key(i, max_key);
}
printf("starting big long delete run\n");
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
while(root->node && btrfs_header_nritems(root->node) > 0) {
struct extent_buffer *leaf;
int slot;