Lines Matching refs:em

15 	struct extent_map *em;  in free_extent_map_tree()  local
21 em = rb_entry(node, struct extent_map, rb_node); in free_extent_map_tree()
22 remove_extent_mapping(em_tree, em); in free_extent_map_tree()
25 if (refcount_read(&em->refs) != 1) { in free_extent_map_tree()
28 em->start, em->len, em->block_start, in free_extent_map_tree()
29 em->block_len, refcount_read(&em->refs)); in free_extent_map_tree()
31 refcount_set(&em->refs, 1); in free_extent_map_tree()
34 free_extent_map(em); in free_extent_map_tree()
58 struct extent_map *em; in test_case_1() local
63 em = alloc_extent_map(); in test_case_1()
64 if (!em) { in test_case_1()
70 em->start = 0; in test_case_1()
71 em->len = SZ_16K; in test_case_1()
72 em->block_start = 0; in test_case_1()
73 em->block_len = SZ_16K; in test_case_1()
75 ret = add_extent_mapping(em_tree, em, 0); in test_case_1()
81 free_extent_map(em); in test_case_1()
84 em = alloc_extent_map(); in test_case_1()
85 if (!em) { in test_case_1()
91 em->start = SZ_16K; in test_case_1()
92 em->len = SZ_4K; in test_case_1()
93 em->block_start = SZ_32K; /* avoid merging */ in test_case_1()
94 em->block_len = SZ_4K; in test_case_1()
96 ret = add_extent_mapping(em_tree, em, 0); in test_case_1()
102 free_extent_map(em); in test_case_1()
104 em = alloc_extent_map(); in test_case_1()
105 if (!em) { in test_case_1()
112 em->start = start; in test_case_1()
113 em->len = len; in test_case_1()
114 em->block_start = start; in test_case_1()
115 em->block_len = len; in test_case_1()
117 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, em->start, em->len); in test_case_1()
123 if (em && in test_case_1()
124 (em->start != 0 || extent_map_end(em) != SZ_16K || in test_case_1()
125 em->block_start != 0 || em->block_len != SZ_16K)) { in test_case_1()
128 start, start + len, ret, em->start, em->len, in test_case_1()
129 em->block_start, em->block_len); in test_case_1()
132 free_extent_map(em); in test_case_1()
148 struct extent_map *em; in test_case_2() local
151 em = alloc_extent_map(); in test_case_2()
152 if (!em) { in test_case_2()
158 em->start = 0; in test_case_2()
159 em->len = SZ_1K; in test_case_2()
160 em->block_start = EXTENT_MAP_INLINE; in test_case_2()
161 em->block_len = (u64)-1; in test_case_2()
163 ret = add_extent_mapping(em_tree, em, 0); in test_case_2()
169 free_extent_map(em); in test_case_2()
172 em = alloc_extent_map(); in test_case_2()
173 if (!em) { in test_case_2()
179 em->start = SZ_4K; in test_case_2()
180 em->len = SZ_4K; in test_case_2()
181 em->block_start = SZ_4K; in test_case_2()
182 em->block_len = SZ_4K; in test_case_2()
184 ret = add_extent_mapping(em_tree, em, 0); in test_case_2()
190 free_extent_map(em); in test_case_2()
192 em = alloc_extent_map(); in test_case_2()
193 if (!em) { in test_case_2()
200 em->start = 0; in test_case_2()
201 em->len = SZ_1K; in test_case_2()
202 em->block_start = EXTENT_MAP_INLINE; in test_case_2()
203 em->block_len = (u64)-1; in test_case_2()
205 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, em->start, em->len); in test_case_2()
211 if (em && in test_case_2()
212 (em->start != 0 || extent_map_end(em) != SZ_1K || in test_case_2()
213 em->block_start != EXTENT_MAP_INLINE || em->block_len != (u64)-1)) { in test_case_2()
216 ret, em->start, em->len, em->block_start, in test_case_2()
217 em->block_len); in test_case_2()
220 free_extent_map(em); in test_case_2()
230 struct extent_map *em; in __test_case_3() local
234 em = alloc_extent_map(); in __test_case_3()
235 if (!em) { in __test_case_3()
241 em->start = SZ_4K; in __test_case_3()
242 em->len = SZ_4K; in __test_case_3()
243 em->block_start = SZ_4K; in __test_case_3()
244 em->block_len = SZ_4K; in __test_case_3()
246 ret = add_extent_mapping(em_tree, em, 0); in __test_case_3()
252 free_extent_map(em); in __test_case_3()
254 em = alloc_extent_map(); in __test_case_3()
255 if (!em) { in __test_case_3()
262 em->start = 0; in __test_case_3()
263 em->len = SZ_16K; in __test_case_3()
264 em->block_start = 0; in __test_case_3()
265 em->block_len = SZ_16K; in __test_case_3()
267 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len); in __test_case_3()
278 if (em && in __test_case_3()
279 (start < em->start || start + len > extent_map_end(em) || in __test_case_3()
280 em->start != em->block_start || em->len != em->block_len)) { in __test_case_3()
283 start, start + len, ret, em->start, em->len, in __test_case_3()
284 em->block_start, em->block_len); in __test_case_3()
287 free_extent_map(em); in __test_case_3()
329 struct extent_map *em; in __test_case_4() local
333 em = alloc_extent_map(); in __test_case_4()
334 if (!em) { in __test_case_4()
340 em->start = 0; in __test_case_4()
341 em->len = SZ_8K; in __test_case_4()
342 em->block_start = 0; in __test_case_4()
343 em->block_len = SZ_8K; in __test_case_4()
345 ret = add_extent_mapping(em_tree, em, 0); in __test_case_4()
351 free_extent_map(em); in __test_case_4()
353 em = alloc_extent_map(); in __test_case_4()
354 if (!em) { in __test_case_4()
361 em->start = SZ_8K; in __test_case_4()
362 em->len = 24 * SZ_1K; in __test_case_4()
363 em->block_start = SZ_16K; /* avoid merging */ in __test_case_4()
364 em->block_len = 24 * SZ_1K; in __test_case_4()
366 ret = add_extent_mapping(em_tree, em, 0); in __test_case_4()
372 free_extent_map(em); in __test_case_4()
374 em = alloc_extent_map(); in __test_case_4()
375 if (!em) { in __test_case_4()
381 em->start = 0; in __test_case_4()
382 em->len = SZ_32K; in __test_case_4()
383 em->block_start = 0; in __test_case_4()
384 em->block_len = SZ_32K; in __test_case_4()
386 ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len); in __test_case_4()
393 if (em && (start < em->start || start + len > extent_map_end(em))) { in __test_case_4()
396 start, len, ret, em->start, em->len, em->block_start, in __test_case_4()
397 em->block_len); in __test_case_4()
400 free_extent_map(em); in __test_case_4()
461 struct extent_map *em; in test_rmap_block() local
467 em = alloc_extent_map(); in test_rmap_block()
468 if (!em) { in test_rmap_block()
475 kfree(em); in test_rmap_block()
480 set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); in test_rmap_block()
482 em->start = SZ_4G; in test_rmap_block()
483 em->len = test->data_stripe_size * test->num_data_stripes; in test_rmap_block()
484 em->block_len = em->len; in test_rmap_block()
485 em->orig_block_len = test->data_stripe_size; in test_rmap_block()
486 em->map_lookup = map; in test_rmap_block()
505 ret = add_extent_mapping(&fs_info->mapping_tree, em, 0); in test_rmap_block()
512 ret = btrfs_rmap_block(fs_info, em->start, NULL, btrfs_sb_offset(1), in test_rmap_block()
542 remove_extent_mapping(&fs_info->mapping_tree, em); in test_rmap_block()
545 free_extent_map(em); in test_rmap_block()
548 free_extent_map(em); in test_rmap_block()