Lines Matching refs:ext
75 struct bmap_rb_extent *ext; in print_tree() local
81 ext = node_to_extent(node); in print_tree()
83 ext->start, ext->start + ext->count); in print_tree()
91 struct bmap_rb_extent *ext, *old = NULL; in check_tree() local
95 ext = node_to_extent(node); in check_tree()
96 if (ext->count == 0) { in check_tree()
98 printf("extent: %llu -> %llu (%llu)\n", ext->start, in check_tree()
99 ext->start + ext->count, ext->count); in check_tree()
102 if (ext->start + ext->count < ext->start) { in check_tree()
104 printf("extent: %llu -> %llu (%llu)\n", ext->start, in check_tree()
105 ext->start + ext->count, ext->count); in check_tree()
110 if (old->start > ext->start) { in check_tree()
116 ext->start, ext->start + ext->count, in check_tree()
117 ext->count); in check_tree()
120 if ((old->start + old->count) >= ext->start) { in check_tree()
126 ext->start, ext->start + ext->count, in check_tree()
127 ext->count); in check_tree()
131 old = ext; in check_tree()
145 static void rb_get_new_extent(struct bmap_rb_extent **ext, __u64 start, in rb_get_new_extent() argument
158 *ext = new_ext; in rb_get_new_extent()
163 struct bmap_rb_extent *ext) in rb_free_extent() argument
165 if (bp->wcursor == ext) in rb_free_extent()
167 if (bp->rcursor == ext) in rb_free_extent()
169 if (bp->rcursor_next == ext) in rb_free_extent()
171 ext2fs_free_mem(&ext); in rb_free_extent()
211 struct bmap_rb_extent *ext; in rb_free_tree() local
216 ext = node_to_extent(node); in rb_free_tree()
218 ext2fs_free_mem(&ext); in rb_free_tree()
280 struct bmap_rb_extent *ext; in rb_truncate() local
285 ext = node_to_extent(node); in rb_truncate()
287 if ((ext->start + ext->count - 1) <= new_max) in rb_truncate()
289 else if (ext->start > new_max) { in rb_truncate()
291 ext2fs_free_mem(&ext); in rb_truncate()
295 ext->count = new_max - ext->start + 1; in rb_truncate()
327 struct bmap_rb_extent *ext; in rb_test_bit() local
370 ext = node_to_extent(parent); in rb_test_bit()
371 if (bit < ext->start) in rb_test_bit()
373 else if (bit >= (ext->start + ext->count)) in rb_test_bit()
376 bp->rcursor = ext; in rb_test_bit()
391 struct bmap_rb_extent *ext; in rb_insert_extent() local
395 ext = bp->wcursor; in rb_insert_extent()
396 if (ext) { in rb_insert_extent()
397 if (start >= ext->start && in rb_insert_extent()
398 start <= (ext->start + ext->count)) { in rb_insert_extent()
408 ext = node_to_extent(parent); in rb_insert_extent()
410 if (start < ext->start) { in rb_insert_extent()
412 } else if (start > (ext->start + ext->count)) { in rb_insert_extent()
416 if ((start + count) <= (ext->start + ext->count)) in rb_insert_extent()
419 if ((ext->start + ext->count) == start) in rb_insert_extent()
424 count += (start - ext->start); in rb_insert_extent()
425 start = ext->start; in rb_insert_extent()
426 new_ext = ext; in rb_insert_extent()
427 new_node = &ext->node; in rb_insert_extent()
442 ext = node_to_extent(node); in rb_insert_extent()
443 if ((ext->start + ext->count) == start) { in rb_insert_extent()
444 start = ext->start; in rb_insert_extent()
445 count += ext->count; in rb_insert_extent()
447 rb_free_extent(bp, ext); in rb_insert_extent()
455 ext = node_to_extent(node); in rb_insert_extent()
457 if ((ext->start + ext->count) <= start) in rb_insert_extent()
461 if ((start + count) < ext->start) in rb_insert_extent()
465 if ((start + count) >= (ext->start + ext->count)) { in rb_insert_extent()
467 rb_free_extent(bp, ext); in rb_insert_extent()
471 count += ((ext->start + ext->count) - in rb_insert_extent()
474 rb_free_extent(bp, ext); in rb_insert_extent()
491 struct bmap_rb_extent *ext; in rb_remove_extent() local
500 ext = node_to_extent(parent); in rb_remove_extent()
501 if (start < ext->start) { in rb_remove_extent()
504 } else if (start >= (ext->start + ext->count)) { in rb_remove_extent()
509 if ((start > ext->start) && in rb_remove_extent()
510 (start + count) < (ext->start + ext->count)) { in rb_remove_extent()
513 new_count = (ext->start + ext->count) - new_start; in rb_remove_extent()
515 ext->count = start - ext->start; in rb_remove_extent()
521 if ((start + count) >= (ext->start + ext->count)) { in rb_remove_extent()
522 ext->count = start - ext->start; in rb_remove_extent()
526 if (0 == ext->count) { in rb_remove_extent()
527 parent = ext2fs_rb_next(&ext->node); in rb_remove_extent()
528 ext2fs_rb_erase(&ext->node, root); in rb_remove_extent()
529 rb_free_extent(bp, ext); in rb_remove_extent()
533 if (start == ext->start) { in rb_remove_extent()
534 ext->start += count; in rb_remove_extent()
535 ext->count -= count; in rb_remove_extent()
543 ext = node_to_extent(parent); in rb_remove_extent()
544 if ((ext->start + ext->count) <= start) in rb_remove_extent()
548 if ((start + count) < ext->start) in rb_remove_extent()
552 if ((start + count) >= (ext->start + ext->count)) { in rb_remove_extent()
554 rb_free_extent(bp, ext); in rb_remove_extent()
559 ext->count -= ((start + count) - ext->start); in rb_remove_extent()
560 ext->start = start + count; in rb_remove_extent()
637 struct bmap_rb_extent *ext; in rb_test_clear_bmap_extent() local
654 ext = node_to_extent(parent); in rb_test_clear_bmap_extent()
655 if (start < ext->start) { in rb_test_clear_bmap_extent()
657 } else if (start >= (ext->start + ext->count)) { in rb_test_clear_bmap_extent()
671 ext = node_to_extent(node); in rb_test_clear_bmap_extent()
674 if ((ext->start + ext->count) <= start) in rb_test_clear_bmap_extent()
678 if ((start + len) <= ext->start) in rb_test_clear_bmap_extent()
739 struct bmap_rb_extent *ext; in rb_get_bmap_range() local
751 ext = node_to_extent(parent); in rb_get_bmap_range()
752 if (start < ext->start) { in rb_get_bmap_range()
754 } else if (start >= (ext->start + ext->count)) { in rb_get_bmap_range()
764 ext = node_to_extent(parent); in rb_get_bmap_range()
766 pos = ext->start; in rb_get_bmap_range()
767 count = ext->count; in rb_get_bmap_range()
816 struct bmap_rb_extent *ext; in rb_find_first_zero() local
831 ext = node_to_extent(parent); in rb_find_first_zero()
832 if (start < ext->start) { in rb_find_first_zero()
834 } else if (start >= (ext->start + ext->count)) { in rb_find_first_zero()
836 } else if (ext->start + ext->count <= end) { in rb_find_first_zero()
837 *out = ext->start + ext->count + bitmap->start; in rb_find_first_zero()
853 struct bmap_rb_extent *ext; in rb_find_first_set() local
868 ext = node_to_extent(parent); in rb_find_first_set()
869 if (start < ext->start) { in rb_find_first_set()
871 } else if (start >= (ext->start + ext->count)) { in rb_find_first_set()
881 ext = node_to_extent(node); in rb_find_first_set()
882 if (ext->start < start) { in rb_find_first_set()
886 ext = node_to_extent(node); in rb_find_first_set()
888 if (ext->start <= end) { in rb_find_first_set()
889 *out = ext->start + bitmap->start; in rb_find_first_set()
900 struct bmap_rb_extent *ext; in rb_print_stats() local
915 ext = node_to_extent(node); in rb_print_stats()
917 if (ext->count > max_size) in rb_print_stats()
918 max_size = ext->count; in rb_print_stats()
919 if (ext->count < min_size) in rb_print_stats()
920 min_size = ext->count; in rb_print_stats()
921 size += ext->count; in rb_print_stats()