• Home
  • Raw
  • Download

Lines Matching full:em

16 	struct extent_map *em;  in free_extent_map_tree()  local
22 em = rb_entry(node, struct extent_map, rb_node); in free_extent_map_tree()
23 remove_extent_mapping(em_tree, em); in free_extent_map_tree()
26 if (refcount_read(&em->refs) != 1) { in free_extent_map_tree()
28 "em leak: em (start 0x%llx len 0x%llx block_start 0x%llx block_len 0x%llx) refs %d", in free_extent_map_tree()
29 em->start, em->len, em->block_start, in free_extent_map_tree()
30 em->block_len, refcount_read(&em->refs)); in free_extent_map_tree()
32 refcount_set(&em->refs, 1); in free_extent_map_tree()
35 free_extent_map(em); in free_extent_map_tree()
52 * -> return em
59 struct extent_map *em; in test_case_1() local
64 em = alloc_extent_map(); in test_case_1()
65 if (!em) { in test_case_1()
71 em->start = 0; in test_case_1()
72 em->len = SZ_16K; in test_case_1()
73 em->block_start = 0; in test_case_1()
74 em->block_len = SZ_16K; in test_case_1()
76 ret = add_extent_mapping(em_tree, em, 0); in test_case_1()
82 free_extent_map(em); in test_case_1()
85 em = alloc_extent_map(); in test_case_1()
86 if (!em) { in test_case_1()
92 em->start = SZ_16K; in test_case_1()
93 em->len = SZ_4K; in test_case_1()
94 em->block_start = SZ_32K; /* avoid merging */ in test_case_1()
95 em->block_len = SZ_4K; in test_case_1()
97 ret = add_extent_mapping(em_tree, em, 0); in test_case_1()
103 free_extent_map(em); in test_case_1()
105 em = alloc_extent_map(); in test_case_1()
106 if (!em) { in test_case_1()
113 em->start = start; in test_case_1()
114 em->len = len; in test_case_1()
115 em->block_start = start; in test_case_1()
116 em->block_len = len; in test_case_1()
118 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, em->start, em->len); in test_case_1()
124 if (em && in test_case_1()
125 (em->start != 0 || extent_map_end(em) != SZ_16K || in test_case_1()
126 em->block_start != 0 || em->block_len != SZ_16K)) { in test_case_1()
128 "case1 [%llu %llu]: ret %d return a wrong em (start %llu len %llu block_start %llu block_len %llu", in test_case_1()
129 start, start + len, ret, em->start, em->len, in test_case_1()
130 em->block_start, em->block_len); in test_case_1()
133 free_extent_map(em); in test_case_1()
149 struct extent_map *em; in test_case_2() local
152 em = alloc_extent_map(); in test_case_2()
153 if (!em) { in test_case_2()
159 em->start = 0; in test_case_2()
160 em->len = SZ_1K; in test_case_2()
161 em->block_start = EXTENT_MAP_INLINE; in test_case_2()
162 em->block_len = (u64)-1; in test_case_2()
164 ret = add_extent_mapping(em_tree, em, 0); in test_case_2()
170 free_extent_map(em); in test_case_2()
173 em = alloc_extent_map(); in test_case_2()
174 if (!em) { in test_case_2()
180 em->start = SZ_4K; in test_case_2()
181 em->len = SZ_4K; in test_case_2()
182 em->block_start = SZ_4K; in test_case_2()
183 em->block_len = SZ_4K; in test_case_2()
185 ret = add_extent_mapping(em_tree, em, 0); in test_case_2()
191 free_extent_map(em); in test_case_2()
193 em = alloc_extent_map(); in test_case_2()
194 if (!em) { in test_case_2()
201 em->start = 0; in test_case_2()
202 em->len = SZ_1K; in test_case_2()
203 em->block_start = EXTENT_MAP_INLINE; in test_case_2()
204 em->block_len = (u64)-1; in test_case_2()
206 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, em->start, em->len); in test_case_2()
212 if (em && in test_case_2()
213 (em->start != 0 || extent_map_end(em) != SZ_1K || in test_case_2()
214 em->block_start != EXTENT_MAP_INLINE || em->block_len != (u64)-1)) { in test_case_2()
216 "case2 [0 1K]: ret %d return a wrong em (start %llu len %llu block_start %llu block_len %llu", in test_case_2()
217 ret, em->start, em->len, em->block_start, in test_case_2()
218 em->block_len); in test_case_2()
221 free_extent_map(em); in test_case_2()
231 struct extent_map *em; in __test_case_3() local
235 em = alloc_extent_map(); in __test_case_3()
236 if (!em) { in __test_case_3()
242 em->start = SZ_4K; in __test_case_3()
243 em->len = SZ_4K; in __test_case_3()
244 em->block_start = SZ_4K; in __test_case_3()
245 em->block_len = SZ_4K; in __test_case_3()
247 ret = add_extent_mapping(em_tree, em, 0); in __test_case_3()
253 free_extent_map(em); in __test_case_3()
255 em = alloc_extent_map(); in __test_case_3()
256 if (!em) { in __test_case_3()
263 em->start = 0; in __test_case_3()
264 em->len = SZ_16K; in __test_case_3()
265 em->block_start = 0; in __test_case_3()
266 em->block_len = SZ_16K; in __test_case_3()
268 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len); in __test_case_3()
276 * Since bytes within em are contiguous, em->block_start is identical to in __test_case_3()
277 * em->start. in __test_case_3()
279 if (em && in __test_case_3()
280 (start < em->start || start + len > extent_map_end(em) || in __test_case_3()
281 em->start != em->block_start || em->len != em->block_len)) { in __test_case_3()
283 "case3 [0x%llx 0x%llx): ret %d em (start 0x%llx len 0x%llx block_start 0x%llx block_len 0x%llx)", in __test_case_3()
284 start, start + len, ret, em->start, em->len, in __test_case_3()
285 em->block_start, em->block_len); in __test_case_3()
288 free_extent_map(em); in __test_case_3()
303 * t1 goes ahead of t2 and adds em [4K, 8K) into tree.
330 struct extent_map *em; in __test_case_4() local
334 em = alloc_extent_map(); in __test_case_4()
335 if (!em) { in __test_case_4()
341 em->start = 0; in __test_case_4()
342 em->len = SZ_8K; in __test_case_4()
343 em->block_start = 0; in __test_case_4()
344 em->block_len = SZ_8K; in __test_case_4()
346 ret = add_extent_mapping(em_tree, em, 0); in __test_case_4()
352 free_extent_map(em); in __test_case_4()
354 em = alloc_extent_map(); in __test_case_4()
355 if (!em) { in __test_case_4()
362 em->start = SZ_8K; in __test_case_4()
363 em->len = 24 * SZ_1K; in __test_case_4()
364 em->block_start = SZ_16K; /* avoid merging */ in __test_case_4()
365 em->block_len = 24 * SZ_1K; in __test_case_4()
367 ret = add_extent_mapping(em_tree, em, 0); in __test_case_4()
373 free_extent_map(em); in __test_case_4()
375 em = alloc_extent_map(); in __test_case_4()
376 if (!em) { in __test_case_4()
382 em->start = 0; in __test_case_4()
383 em->len = SZ_32K; in __test_case_4()
384 em->block_start = 0; in __test_case_4()
385 em->block_len = SZ_32K; in __test_case_4()
387 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len); in __test_case_4()
394 if (em && (start < em->start || start + len > extent_map_end(em))) { in __test_case_4()
396 "case4 [0x%llx 0x%llx): ret %d, added wrong em (start 0x%llx len 0x%llx block_start 0x%llx block_le… in __test_case_4()
397 start, len, ret, em->start, em->len, em->block_start, in __test_case_4()
398 em->block_len); in __test_case_4()
401 free_extent_map(em); in __test_case_4()
416 * t1 goes ahead of t2 and splits em [0, 32K) to em [0K, 8K) and [8K 32K).
449 struct extent_map *em; in add_compressed_extent() local
452 em = alloc_extent_map(); in add_compressed_extent()
453 if (!em) { in add_compressed_extent()
458 em->start = start; in add_compressed_extent()
459 em->len = len; in add_compressed_extent()
460 em->block_start = block_start; in add_compressed_extent()
461 em->block_len = SZ_4K; in add_compressed_extent()
462 set_bit(EXTENT_FLAG_COMPRESSED, &em->flags); in add_compressed_extent()
464 ret = add_extent_mapping(em_tree, em, 0); in add_compressed_extent()
466 free_extent_map(em); in add_compressed_extent()
565 * [32k, 64k) - test whole em dropping
567 * They'll have the EXTENT_FLAG_COMPRESSED flag set to keep the em tree from
568 * merging the em's.
659 * Test the btrfs_add_extent_mapping helper which will attempt to create an em
661 * are two unmerged em's side by side.
665 struct extent_map *em = NULL; in test_case_6() local
676 em = alloc_extent_map(); in test_case_6()
677 if (!em) { in test_case_6()
682 em->start = SZ_4K; in test_case_6()
683 em->len = SZ_4K; in test_case_6()
684 em->block_start = SZ_16K; in test_case_6()
685 em->block_len = SZ_16K; in test_case_6()
687 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, 0, SZ_8K); in test_case_6()
691 test_err("got an error when adding our em: %d", ret); in test_case_6()
696 if (em->start != 0) { in test_case_6()
697 test_err("unexpected em->start at %llu, wanted 0", em->start); in test_case_6()
700 if (em->len != SZ_4K) { in test_case_6()
701 test_err("unexpected em->len %llu, expected 4K", em->len); in test_case_6()
706 free_extent_map(em); in test_case_6()
719 struct extent_map *em; in test_case_7() local
733 em = alloc_extent_map(); in test_case_7()
734 if (!em) { in test_case_7()
741 em->start = 0; in test_case_7()
742 em->len = SZ_16K; in test_case_7()
743 em->block_start = 0; in test_case_7()
744 em->block_len = SZ_4K; in test_case_7()
745 set_bit(EXTENT_FLAG_PINNED, &em->flags); in test_case_7()
747 ret = add_extent_mapping(em_tree, em, 0); in test_case_7()
753 free_extent_map(em); in test_case_7()
755 em = alloc_extent_map(); in test_case_7()
756 if (!em) { in test_case_7()
763 em->start = SZ_32K; in test_case_7()
764 em->len = SZ_16K; in test_case_7()
765 em->block_start = SZ_32K; in test_case_7()
766 em->block_len = SZ_16K; in test_case_7()
768 ret = add_extent_mapping(em_tree, em, 0); in test_case_7()
774 free_extent_map(em); in test_case_7()
785 em = lookup_extent_mapping(em_tree, 0, SZ_16K); in test_case_7()
786 if (!em) { in test_case_7()
787 test_err("didn't find an em at 0 as expected"); in test_case_7()
791 if (em->start != 0) { in test_case_7()
792 test_err("em->start is %llu, expected 0", em->start); in test_case_7()
796 if (em->len != SZ_16K) { in test_case_7()
797 test_err("em->len is %llu, expected 16K", em->len); in test_case_7()
801 free_extent_map(em); in test_case_7()
804 em = lookup_extent_mapping(em_tree, SZ_16K, SZ_16K); in test_case_7()
806 if (em) { in test_case_7()
807 test_err("found an em when we weren't expecting one"); in test_case_7()
812 em = lookup_extent_mapping(em_tree, SZ_32K, SZ_16K); in test_case_7()
814 if (!em) { in test_case_7()
815 test_err("didn't find an em at 32K as expected"); in test_case_7()
819 if (em->start != (36 * SZ_1K)) { in test_case_7()
820 test_err("em->start is %llu, expected 36K", em->start); in test_case_7()
824 if (em->len != (12 * SZ_1K)) { in test_case_7()
825 test_err("em->len is %llu, expected 12K", em->len); in test_case_7()
829 if (em->block_start != SZ_32K + SZ_4K) { in test_case_7()
830 test_err("em->block_start is %llu, expected 36K", em->block_start); in test_case_7()
834 free_extent_map(em); in test_case_7()
837 em = lookup_extent_mapping(em_tree, 48 * SZ_1K, (u64)-1); in test_case_7()
839 if (em) { in test_case_7()
840 test_err("found an unexpected em above 48K"); in test_case_7()
846 free_extent_map(em); in test_case_7()
867 struct extent_map *em; in test_rmap_block() local
873 em = alloc_extent_map(); in test_rmap_block()
874 if (!em) { in test_rmap_block()
881 kfree(em); in test_rmap_block()
886 set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); in test_rmap_block()
888 em->start = SZ_4G; in test_rmap_block()
889 em->len = test->data_stripe_size * test->num_data_stripes; in test_rmap_block()
890 em->block_len = em->len; in test_rmap_block()
891 em->orig_block_len = test->data_stripe_size; in test_rmap_block()
892 em->map_lookup = map; in test_rmap_block()
910 ret = add_extent_mapping(&fs_info->mapping_tree, em, 0); in test_rmap_block()
917 ret = btrfs_rmap_block(fs_info, em->start, btrfs_sb_offset(1), in test_rmap_block()
947 remove_extent_mapping(&fs_info->mapping_tree, em); in test_rmap_block()
950 free_extent_map(em); in test_rmap_block()
953 free_extent_map(em); in test_rmap_block()