Lines Matching full:bt
89 verify_contents(avl_tree_t *avl, zfs_btree_t *bt) in verify_contents() argument
99 ASSERT3U(avl_numnodes(avl), ==, zfs_btree_numnodes(bt)); in verify_contents()
102 data = zfs_btree_first(bt, &bt_idx); in verify_contents()
105 data = zfs_btree_last(bt, &bt_idx); in verify_contents()
111 data = zfs_btree_next(bt, &bt_idx, &bt_idx); in verify_contents()
114 data = zfs_btree_prev(bt, &bt_idx, &bt_idx); in verify_contents()
121 verify_node(avl_tree_t *avl, zfs_btree_t *bt, int_node_t *node) in verify_node() argument
129 ASSERT3U(avl_numnodes(avl), ==, zfs_btree_numnodes(bt)); in verify_node()
130 ASSERT3P((rv = (uint64_t *)zfs_btree_find(bt, &data, &bt_idx)), !=, in verify_node()
133 ASSERT3P(zfs_btree_get(bt, &bt_idx), !=, NULL); in verify_node()
134 ASSERT3S(data, ==, *(uint64_t *)zfs_btree_get(bt, &bt_idx)); in verify_node()
137 ASSERT3P((rv = zfs_btree_next(bt, &bt_idx, &bt_idx2)), !=, in verify_node()
139 ASSERT3P(rv, ==, zfs_btree_get(bt, &bt_idx2)); in verify_node()
142 ASSERT3U(data, ==, *(uint64_t *)zfs_btree_last(bt, &bt_idx)); in verify_node()
146 ASSERT3P((rv = zfs_btree_prev(bt, &bt_idx, &bt_idx2)), !=, in verify_node()
148 ASSERT3P(rv, ==, zfs_btree_get(bt, &bt_idx2)); in verify_node()
151 ASSERT3U(data, ==, *(uint64_t *)zfs_btree_first(bt, &bt_idx)); in verify_node()
161 find_without_index(zfs_btree_t *bt, char *why) in find_without_index() argument
165 zfs_btree_add(bt, &i); in find_without_index()
166 if ((p = (u_longlong_t *)zfs_btree_find(bt, &i, NULL)) == NULL || in find_without_index()
175 if ((p = (u_longlong_t *)zfs_btree_find(bt, &i, NULL)) != NULL) { in find_without_index()
185 insert_find_remove(zfs_btree_t *bt, char *why) in insert_find_remove() argument
191 zfs_btree_add(bt, &i); in insert_find_remove()
192 if ((p = (u_longlong_t *)zfs_btree_find(bt, &i, &bt_idx)) == NULL) { in insert_find_remove()
199 ASSERT3S(zfs_btree_numnodes(bt), ==, 1); in insert_find_remove()
200 zfs_btree_verify(bt); in insert_find_remove()
203 zfs_btree_remove(bt, &i); in insert_find_remove()
204 if ((p = (u_longlong_t *)zfs_btree_find(bt, &i, &bt_idx)) != NULL) { in insert_find_remove()
209 ASSERT3S(zfs_btree_numnodes(bt), ==, 0); in insert_find_remove()
210 zfs_btree_verify(bt); in insert_find_remove()
221 drain_tree(zfs_btree_t *bt, char *why) in drain_tree() argument
235 if (zfs_btree_find(bt, &randval, &bt_idx) != NULL) { in drain_tree()
238 zfs_btree_add_idx(bt, &randval, &bt_idx); in drain_tree()
259 ASSERT3U(avl_numnodes(&avl), ==, zfs_btree_numnodes(bt)); in drain_tree()
262 data = zfs_btree_first(bt, &bt_idx); in drain_tree()
265 data = zfs_btree_last(bt, &bt_idx); in drain_tree()
268 zfs_btree_remove_idx(bt, &bt_idx); in drain_tree()
277 *(uint64_t *)zfs_btree_first(bt, NULL)); in drain_tree()
279 ASSERT3U(node->data, ==, *(uint64_t *)zfs_btree_last(bt, NULL)); in drain_tree()
281 ASSERT3S(zfs_btree_numnodes(bt), ==, 0); in drain_tree()
299 stress_tree(zfs_btree_t *bt, char *why) in stress_tree() argument
334 ASSERT3P(zfs_btree_find(bt, &randval, &bt_idx), ==, in stress_tree()
336 zfs_btree_add_idx(bt, &randval, &bt_idx); in stress_tree()
337 verify_node(&avl, bt, node); in stress_tree()
340 verify_node(&avl, bt, ret); in stress_tree()
341 zfs_btree_remove(bt, &randval); in stress_tree()
347 zfs_btree_verify(bt); in stress_tree()
351 verify_contents(&avl, bt); in stress_tree()
354 zfs_btree_verify(bt); in stress_tree()
371 while (zfs_btree_destroy_nodes(bt, &idx) != NULL) in stress_tree()
373 zfs_btree_verify(bt); in stress_tree()
384 insert_duplicate(zfs_btree_t *bt) in insert_duplicate() argument
389 if (zfs_btree_find(bt, &i, &bt_idx) != NULL) { in insert_duplicate()
393 zfs_btree_add_idx(bt, &i, &bt_idx); in insert_duplicate()
394 if (zfs_btree_find(bt, &i, &bt_idx) == NULL) { in insert_duplicate()
400 zfs_btree_add_idx(bt, &i, NULL); in insert_duplicate()
410 remove_missing(zfs_btree_t *bt) in remove_missing() argument
415 if (zfs_btree_find(bt, &i, &bt_idx) != NULL) { in remove_missing()
421 zfs_btree_remove(bt, &i); in remove_missing()
427 do_negative_test(zfs_btree_t *bt, char *test_name) in do_negative_test() argument
435 rval = insert_duplicate(bt); in do_negative_test()
437 rval = remove_missing(bt); in do_negative_test()
467 zfs_btree_t bt; in main() local
504 zfs_btree_create(&bt, zfs_btree_compare, NULL, sizeof (uint64_t)); in main()
511 return (do_negative_test(&bt, negative_test)); in main()
522 return (stress_tree(&bt, NULL)); in main()
533 retval = test->func(&bt, why); in main()
546 while (zfs_btree_destroy_nodes(&bt, &idx) != NULL) in main()
548 zfs_btree_verify(&bt); in main()
553 zfs_btree_verify(&bt); in main()