Lines Matching refs:node_ro
90 static bool block_tree_node_is_leaf(const struct block_tree_node* node_ro) { in block_tree_node_is_leaf() argument
91 assert(node_ro); in block_tree_node_is_leaf()
92 assert(node_ro->is_leaf <= 1); in block_tree_node_is_leaf()
94 return node_ro->is_leaf; in block_tree_node_is_leaf()
176 const struct block_tree_node* node_ro) { in block_tree_node_max_key_count() argument
177 return block_tree_max_key_count(tree, block_tree_node_is_leaf(node_ro)); in block_tree_node_max_key_count()
460 const struct block_tree_node* node_ro, in block_tree_node_get_key() argument
464 const size_t key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_get_key()
467 assert(node_ro); in block_tree_node_get_key()
470 keyp = node_ro->data + index * tree->key_size; in block_tree_node_get_key()
515 const struct block_tree_node* node_ro, in block_tree_node_get_child_data() argument
517 bool is_leaf = block_tree_node_is_leaf(node_ro); in block_tree_node_get_child_data()
524 child_data = node_ro->data + tree->key_size * max_key_count + in block_tree_node_get_child_data()
527 assert(child_data > (void*)node_ro->data); in block_tree_node_get_child_data()
528 assert(child_data < (void*)node_ro + tree->block_size); in block_tree_node_get_child_data()
561 const struct block_tree_node* node_ro, in block_tree_node_get_child() argument
564 const size_t key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_get_child()
566 assert(!block_tree_node_is_leaf(node_ro)); in block_tree_node_get_child()
569 child = block_tree_node_get_child_data(tree, node_ro, index); in block_tree_node_get_child()
600 const struct block_tree_node* node_ro, in block_tree_node_get_data() argument
604 const size_t max_key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_get_data()
606 assert(block_tree_node_is_leaf(node_ro)); in block_tree_node_get_data()
609 datap = block_tree_node_get_child_data(tree, node_ro, index); in block_tree_node_get_data()
627 #define block_tree_node_for_each_child(tr, tree, block, node_ro, child, i) \ argument
629 (child = block_tree_node_get_child(tr, tree, block, node_ro, i)); \
643 const struct block_tree_node* node_ro) { in block_tree_node_print_internal() argument
646 const size_t key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_print_internal()
648 assert(!block_tree_node_is_leaf(node_ro)); in block_tree_node_print_internal()
651 child = block_tree_node_get_child(tr, tree, node_block, node_ro, i); in block_tree_node_print_internal()
657 if (block_tree_node_get_key(tree, node_block, node_ro, i)) { in block_tree_node_print_internal()
662 block_tree_node_get_key(tree, node_block, node_ro, i)); in block_tree_node_print_internal()
665 assert(!block_tree_node_get_child(tr, tree, node_block, node_ro, i)); in block_tree_node_print_internal()
679 const struct block_tree_node* node_ro) { in block_tree_node_print_leaf() argument
683 const size_t key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_print_leaf()
685 assert(block_tree_node_is_leaf(node_ro)); in block_tree_node_print_leaf()
688 key = block_tree_node_get_key(tree, node_block, node_ro, i); in block_tree_node_print_leaf()
689 data = block_tree_node_get_data(tr, tree, node_block, node_ro, i); in block_tree_node_print_leaf()
713 const struct block_tree_node* node_ro) { in block_tree_node_print() argument
715 if (node_ro->is_leaf == true) { in block_tree_node_print()
716 block_tree_node_print_leaf(tr, tree, node_block, node_ro); in block_tree_node_print()
717 } else if (!node_ro->is_leaf) { in block_tree_node_print()
718 block_tree_node_print_internal(tr, tree, node_block, node_ro); in block_tree_node_print()
720 printf(" bad node header %" PRIx64 "\n", node_ro->is_leaf); in block_tree_node_print()
734 const struct block_tree_node* node_ro; in block_tree_print_sub_tree() local
743 node_ro = block_get(tr, block_mac, NULL, &node_ref); in block_tree_print_sub_tree()
744 if (!node_ro) { in block_tree_print_sub_tree()
749 block_tree_node_print(tr, tree, block_mac_to_block(tr, block_mac), node_ro); in block_tree_print_sub_tree()
750 if (!node_ro->is_leaf) { in block_tree_print_sub_tree()
753 node_ro, child, i) { in block_tree_print_sub_tree()
757 block_put(node_ro, &node_ref); in block_tree_print_sub_tree()
782 const struct block_tree_node* node_ro, in block_tree_node_check() argument
791 size_t key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_check()
794 if (node_ro->is_leaf && node_ro->is_leaf != true) { in block_tree_node_check()
795 printf("%s: bad node header %" PRIx64 "\n", __func__, node_ro->is_leaf); in block_tree_node_check()
798 is_leaf = block_tree_node_is_leaf(node_ro); in block_tree_node_check()
802 key = block_tree_node_get_key(tree, node_block, node_ro, i); in block_tree_node_check()
814 block_tree_node_get_child_data(tree, node_ro, i + !is_leaf); in block_tree_node_check()
839 block_tree_node_print(tr, tree, node_block, node_ro); in block_tree_node_check()
868 const struct block_tree_node* node_ro; in block_tree_check_sub_tree() local
895 node_ro = block_get_no_tr_fail(tr, block_mac, NULL, &ref); in block_tree_check_sub_tree()
896 if (!node_ro) { in block_tree_check_sub_tree()
911 if (!block_tree_node_check(tr, tree, node_ro, in block_tree_check_sub_tree()
917 if (node_ro->is_leaf && node_ro->is_leaf != true) { in block_tree_check_sub_tree()
918 printf("%s: bad node header %" PRIx64 "\n", __func__, node_ro->is_leaf); in block_tree_check_sub_tree()
921 is_leaf = block_tree_node_is_leaf(node_ro); in block_tree_check_sub_tree()
923 key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_check_sub_tree()
932 node_ro, i); in block_tree_check_sub_tree()
944 block_tree_node_get_child_data(tree, node_ro, i + !is_leaf); in block_tree_check_sub_tree()
970 child_data = block_tree_node_get_child_data(tree, node_ro, i); in block_tree_check_sub_tree()
972 block_put(node_ro, &ref); in block_tree_check_sub_tree()
976 node_ro = block_get_no_tr_fail(tr, block_mac, NULL, &ref); in block_tree_check_sub_tree()
977 if (!node_ro) { in block_tree_check_sub_tree()
1006 child_data = block_tree_node_get_child_data(tree, node_ro, last_child); in block_tree_check_sub_tree()
1008 block_put(node_ro, &ref); in block_tree_check_sub_tree()
1012 node_ro = block_get_no_tr_fail(tr, block_mac, NULL, &ref); in block_tree_check_sub_tree()
1013 if (!node_ro) { in block_tree_check_sub_tree()
1045 block_put(node_ro, &ref); in block_tree_check_sub_tree()
1050 block_put(node_ro, &ref); in block_tree_check_sub_tree()
1093 const struct block_tree_node* node_ro) { in block_tree_node_full() argument
1094 const size_t key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_full()
1095 return !!block_tree_node_get_key(tree, DATA_BLOCK_INVALID, node_ro, in block_tree_node_full()
1130 const struct block_tree_node* node_ro) { in block_tree_node_min_full_index() argument
1131 return block_tree_min_key_count(tree, block_tree_node_is_leaf(node_ro)) - 1; in block_tree_node_min_full_index()
1144 const struct block_tree_node* node_ro) { in block_tree_above_min_full() argument
1145 int min_full_index = block_tree_node_min_full_index(tree, node_ro); in block_tree_above_min_full()
1146 return !!block_tree_node_get_key(tree, DATA_BLOCK_INVALID, node_ro, in block_tree_above_min_full()
1160 const struct block_tree_node* node_ro) { in block_tree_below_min_full() argument
1161 int min_full_index = block_tree_node_min_full_index(tree, node_ro); in block_tree_below_min_full()
1162 return !block_tree_node_get_key(tree, DATA_BLOCK_INVALID, node_ro, in block_tree_below_min_full()
1205 const struct block_tree_node* node_ro, in block_tree_node_find_block() argument
1214 bool is_leaf = block_tree_node_is_leaf(node_ro); in block_tree_node_find_block()
1216 keys_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_find_block()
1220 curr_key = block_tree_node_get_key(tree, node_block, node_ro, i); in block_tree_node_find_block()
1238 curr_key = block_tree_node_get_key(tree, node_block, node_ro, i); in block_tree_node_find_block()
1246 *prev_key = block_tree_node_get_key(tree, node_block, node_ro, i - 1); in block_tree_node_find_block()
1252 *child = block_tree_node_get_child(tr, tree, node_block, node_ro, i); in block_tree_node_find_block()
1263 block_tree_node_print(tr, tree, node_block, node_ro); in block_tree_node_find_block()
1291 const struct block_tree_node* node_ro; in block_tree_walk() local
1326 node_ro = block_get(tr, block_mac, NULL, &ref[ref_index]); in block_tree_walk()
1327 if (!node_ro) { in block_tree_walk()
1333 assert(node_ro); in block_tree_walk()
1338 tr, path->tree, block_mac_to_block(tr, block_mac), node_ro, key, in block_tree_walk()
1352 assert(block_tree_node_is_leaf(node_ro)); in block_tree_walk()
1354 tr, tree, block_mac_to_block(tr, block_mac), node_ro, in block_tree_walk()
1364 parent_node_ro = node_ro; in block_tree_walk()
1394 const struct block_tree_node* node_ro; in block_tree_path_next() local
1425 node_ro = block_get(path->tr, block_mac, NULL, &ref[ref_index]); in block_tree_path_next()
1426 if (!node_ro) { in block_tree_path_next()
1431 assert(node_ro); in block_tree_path_next()
1432 assert(block_tree_node_is_leaf(node_ro)); in block_tree_path_next()
1435 node_ro, index); in block_tree_path_next()
1439 node_ro, index); in block_tree_path_next()
1442 node_ro, index); in block_tree_path_next()
1443 block_put(node_ro, &ref[ref_index]); in block_tree_path_next()
1476 node_ro = block_get(path->tr, block_mac, NULL, &ref[ref_index]); in block_tree_path_next()
1477 if (!node_ro) { in block_tree_path_next()
1482 assert(node_ro); in block_tree_path_next()
1483 assert(!block_tree_node_is_leaf(node_ro)); in block_tree_path_next()
1488 path->tree, block_mac_to_block(path->tr, block_mac), node_ro, in block_tree_path_next()
1492 path->tree, block_mac_to_block(path->tr, block_mac), node_ro, in block_tree_path_next()
1496 node_ro, index); in block_tree_path_next()
1498 parent_node_ro = node_ro; in block_tree_path_next()
1515 block_put(node_ro, &ref[ref_index]); in block_tree_path_next()
1519 node_ro = block_get(path->tr, next_child, NULL, &ref[ref_index]); in block_tree_path_next()
1520 if (!node_ro) { in block_tree_path_next()
1525 assert(node_ro); in block_tree_path_next()
1526 assert(!block_tree_node_is_leaf(node_ro)); in block_tree_path_next()
1532 path->tree, DATA_BLOCK_INVALID, node_ro, 0); in block_tree_path_next()
1542 DATA_BLOCK_INVALID, node_ro, 0); in block_tree_path_next()
1543 parent_node_ro = node_ro; in block_tree_path_next()
1550 node_ro = block_get(path->tr, next_child, NULL, &ref[ref_index]); in block_tree_path_next()
1551 if (!node_ro) { in block_tree_path_next()
1556 assert(node_ro); in block_tree_path_next()
1557 assert(block_tree_node_is_leaf(node_ro)); in block_tree_path_next()
1563 block_tree_node_get_key(path->tree, DATA_BLOCK_INVALID, node_ro, 0); in block_tree_path_next()
1565 DATA_BLOCK_INVALID, node_ro, 0); in block_tree_path_next()
1566 block_put(node_ro, &ref[ref_index]); in block_tree_path_next()
1602 const struct block_tree_node* node_ro) { in block_tree_block_dirty() argument
1615 return block_dirty(tr, node_ro, !path->tree->allow_copy_on_write); in block_tree_block_dirty()
1638 return block_move(tr, node_ro, new_block, !path->tree->allow_copy_on_write); in block_tree_block_dirty()
1658 const struct block_tree_node* node_ro; in block_tree_block_get_write() local
1661 node_ro = block_get(tr, &path->entry[path_index].block_mac, NULL, ref); in block_tree_block_get_write()
1662 if (!node_ro) { in block_tree_block_get_write()
1666 node_rw = block_tree_block_dirty(tr, path, path_index, node_ro); in block_tree_block_get_write()
1668 block_put(node_ro, ref); in block_tree_block_get_write()
1863 const struct block_tree_node* node_ro) { in block_tree_node_get_key_count() argument
1865 unsigned int max_key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_node_get_key_count()
1868 if (!block_tree_node_get_key(tree, DATA_BLOCK_INVALID, node_ro, i)) { in block_tree_node_get_key_count()
2215 const struct block_tree_node* node_ro; in block_tree_get_sibling_block() local
2224 node_ro = block_get(tr, parent, NULL, &node_ref); in block_tree_get_sibling_block()
2225 if (!node_ro) { in block_tree_get_sibling_block()
2232 block_tree_node_get_child_data(path->tree, node_ro, parent_index); in block_tree_get_sibling_block()
2235 block_put(node_ro, &node_ref); in block_tree_get_sibling_block()
2315 const struct block_tree_node* node_ro; in block_tree_remove_internal() local
2326 node_ro = block_get(tr, block_mac, NULL, &node_ref); in block_tree_remove_internal()
2327 if (!node_ro) { in block_tree_remove_internal()
2332 assert(!block_tree_node_is_leaf(node_ro)); in block_tree_remove_internal()
2338 node_ro); in block_tree_remove_internal()
2342 !block_tree_node_get_key(path->tree, DATA_BLOCK_INVALID, node_ro, 1)) { in block_tree_remove_internal()
2346 block_tree_node_get_child_data(path->tree, node_ro, 0); in block_tree_remove_internal()
2353 block_discard_dirty(node_ro); in block_tree_remove_internal()
2354 block_put(node_ro, &node_ref); in block_tree_remove_internal()
2361 node_rw = block_tree_block_dirty(tr, path, path->count - 1, node_ro); in block_tree_remove_internal()
2363 block_put(node_ro, &node_ref); in block_tree_remove_internal()
2395 const struct block_tree_node* node_ro; in block_tree_node_merge() local
2425 node_ro = block_get(tr, block_mac, NULL, node_ref); in block_tree_node_merge()
2426 if (!node_ro) { in block_tree_node_merge()
2431 assert(node_ro); in block_tree_node_merge()
2432 is_leaf = block_tree_node_is_leaf(node_ro); in block_tree_node_merge()
2437 block_put(node_ro, node_ref); in block_tree_node_merge()
2447 node_ro); in block_tree_node_merge()
2453 assert(block_tree_below_min_full(path->tree, node_ro)); in block_tree_node_merge()
2464 block_put(node_ro, node_ref); in block_tree_node_merge()
2471 node_rw = block_dirty(tr, node_ro, !path->tree->copy_on_write); in block_tree_node_merge()
2552 tmp_node = node_ro; in block_tree_node_merge()
2553 node_ro = merge_node_ro; in block_tree_node_merge()
2562 node_rw = block_tree_block_dirty(tr, path, path->count - 1, node_ro); in block_tree_node_merge()
2565 block_put(node_ro, node_ref); in block_tree_node_merge()
2634 const struct block_tree_node* node_ro; in block_tree_insert_block_mac() local
2681 node_ro = block_get(tr, block_mac, NULL, &node_ref); in block_tree_insert_block_mac()
2682 if (!node_ro) { in block_tree_insert_block_mac()
2691 assert(node_ro); in block_tree_insert_block_mac()
2693 node_ro); in block_tree_insert_block_mac()
2696 assert(node_ro); in block_tree_insert_block_mac()
2697 assert(block_tree_node_is_leaf(node_ro)); in block_tree_insert_block_mac()
2699 block_tree_node_get_key(tree, DATA_BLOCK_INVALID, node_ro, index) == in block_tree_insert_block_mac()
2702 node_rw = block_tree_block_dirty(tr, &path, path.count - 1, node_ro); in block_tree_insert_block_mac()
2706 block_put(node_ro, &node_ref); in block_tree_insert_block_mac()
2768 const struct block_tree_node* node_ro; in block_tree_remove() local
2805 node_ro = block_get(tr, block_mac, NULL, &node_ref); in block_tree_remove()
2806 if (!node_ro) { in block_tree_remove()
2811 assert(block_tree_node_is_leaf(node_ro)); in block_tree_remove()
2812 assert(block_tree_node_get_key(tree, DATA_BLOCK_INVALID, node_ro, index) == in block_tree_remove()
2814 assert(!memcmp(block_tree_node_get_child_data(tree, node_ro, index), &data, in block_tree_remove()
2821 node_ro); in block_tree_remove()
2824 node_rw = block_tree_block_dirty(tr, &path, path.count - 1, node_ro); in block_tree_remove()
2826 block_put(node_ro, &node_ref); in block_tree_remove()
2884 const struct block_tree_node* node_ro; in block_tree_update_block_mac() local
2936 node_ro = block_get(tr, block_mac, NULL, &node_ref); in block_tree_update_block_mac()
2937 if (!node_ro) { in block_tree_update_block_mac()
2942 max_key_count = block_tree_node_max_key_count(tree, node_ro); in block_tree_update_block_mac()
2943 assert(block_tree_node_is_leaf(node_ro)); in block_tree_update_block_mac()
2944 assert(block_tree_node_get_key(tree, DATA_BLOCK_INVALID, node_ro, index) == in block_tree_update_block_mac()
2947 tr, block_tree_node_get_child_data(tree, node_ro, index), in block_tree_update_block_mac()
2956 node_ro); in block_tree_update_block_mac()
2961 node_ro, index + 1) in block_tree_update_block_mac()
2967 node_rw = block_tree_block_dirty(tr, &path, path.count - 1, node_ro); in block_tree_update_block_mac()
2969 block_put(node_ro, &node_ref); in block_tree_update_block_mac()