Lines Matching refs:em

1174 	struct extent_map *em;  in contains_pending_extent()  local
1182 list_for_each_entry(em, search_list, list) { in contains_pending_extent()
1186 map = (struct map_lookup *)em->bdev; in contains_pending_extent()
1193 map->stripes[i].physical + em->orig_block_len <= in contains_pending_extent()
1208 end = map->stripes[i].physical + em->orig_block_len; in contains_pending_extent()
1519 struct extent_map *em; in find_next_chunk() local
1527 em = rb_entry(n, struct extent_map, rb_node); in find_next_chunk()
1528 ret = em->start + em->len; in find_next_chunk()
2732 struct extent_map *em; in btrfs_remove_chunk() local
2744 em = lookup_extent_mapping(em_tree, chunk_offset, 1); in btrfs_remove_chunk()
2747 if (!em || em->start > chunk_offset || in btrfs_remove_chunk()
2748 em->start + em->len < chunk_offset) { in btrfs_remove_chunk()
2755 if (em) in btrfs_remove_chunk()
2756 free_extent_map(em); in btrfs_remove_chunk()
2759 map = (struct map_lookup *)em->bdev; in btrfs_remove_chunk()
2799 trace_btrfs_chunk_free(root, map, chunk_offset, em->len); in btrfs_remove_chunk()
2809 ret = btrfs_remove_block_group(trans, extent_root, chunk_offset, em); in btrfs_remove_chunk()
2817 free_extent_map(em); in btrfs_remove_chunk()
4494 struct extent_map *em; in __btrfs_alloc_chunk() local
4716 em = alloc_extent_map(); in __btrfs_alloc_chunk()
4717 if (!em) { in __btrfs_alloc_chunk()
4722 set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); in __btrfs_alloc_chunk()
4723 em->bdev = (struct block_device *)map; in __btrfs_alloc_chunk()
4724 em->start = start; in __btrfs_alloc_chunk()
4725 em->len = num_bytes; in __btrfs_alloc_chunk()
4726 em->block_start = 0; in __btrfs_alloc_chunk()
4727 em->block_len = em->len; in __btrfs_alloc_chunk()
4728 em->orig_block_len = stripe_size; in __btrfs_alloc_chunk()
4732 ret = add_extent_mapping(em_tree, em, 0); in __btrfs_alloc_chunk()
4734 list_add_tail(&em->list, &trans->transaction->pending_chunks); in __btrfs_alloc_chunk()
4735 atomic_inc(&em->refs); in __btrfs_alloc_chunk()
4739 free_extent_map(em); in __btrfs_alloc_chunk()
4759 free_extent_map(em); in __btrfs_alloc_chunk()
4767 remove_extent_mapping(em_tree, em); in __btrfs_alloc_chunk()
4771 free_extent_map(em); in __btrfs_alloc_chunk()
4773 free_extent_map(em); in __btrfs_alloc_chunk()
4775 free_extent_map(em); in __btrfs_alloc_chunk()
4791 struct extent_map *em; in btrfs_finish_chunk_alloc() local
4801 em = lookup_extent_mapping(em_tree, chunk_offset, chunk_size); in btrfs_finish_chunk_alloc()
4804 if (!em) { in btrfs_finish_chunk_alloc()
4810 if (em->start != chunk_offset || em->len != chunk_size) { in btrfs_finish_chunk_alloc()
4813 chunk_size, em->start, em->len); in btrfs_finish_chunk_alloc()
4814 free_extent_map(em); in btrfs_finish_chunk_alloc()
4818 map = (struct map_lookup *)em->bdev; in btrfs_finish_chunk_alloc()
4820 stripe_size = em->orig_block_len; in btrfs_finish_chunk_alloc()
4881 free_extent_map(em); in btrfs_finish_chunk_alloc()
4947 struct extent_map *em; in btrfs_chunk_readonly() local
4955 em = lookup_extent_mapping(&map_tree->map_tree, chunk_offset, 1); in btrfs_chunk_readonly()
4957 if (!em) in btrfs_chunk_readonly()
4960 map = (struct map_lookup *)em->bdev; in btrfs_chunk_readonly()
4981 free_extent_map(em); in btrfs_chunk_readonly()
4992 struct extent_map *em; in btrfs_mapping_tree_free() local
4996 em = lookup_extent_mapping(&tree->map_tree, 0, (u64)-1); in btrfs_mapping_tree_free()
4997 if (em) in btrfs_mapping_tree_free()
4998 remove_extent_mapping(&tree->map_tree, em); in btrfs_mapping_tree_free()
5000 if (!em) in btrfs_mapping_tree_free()
5003 free_extent_map(em); in btrfs_mapping_tree_free()
5005 free_extent_map(em); in btrfs_mapping_tree_free()
5012 struct extent_map *em; in btrfs_num_copies() local
5018 em = lookup_extent_mapping(em_tree, logical, len); in btrfs_num_copies()
5026 if (!em) { in btrfs_num_copies()
5032 if (em->start > logical || em->start + em->len < logical) { in btrfs_num_copies()
5034 "%Lu-%Lu", logical, logical+len, em->start, in btrfs_num_copies()
5035 em->start + em->len); in btrfs_num_copies()
5036 free_extent_map(em); in btrfs_num_copies()
5040 map = (struct map_lookup *)em->bdev; in btrfs_num_copies()
5051 free_extent_map(em); in btrfs_num_copies()
5065 struct extent_map *em; in btrfs_full_stripe_len() local
5071 em = lookup_extent_mapping(em_tree, logical, len); in btrfs_full_stripe_len()
5073 BUG_ON(!em); in btrfs_full_stripe_len()
5075 BUG_ON(em->start > logical || em->start + em->len < logical); in btrfs_full_stripe_len()
5076 map = (struct map_lookup *)em->bdev; in btrfs_full_stripe_len()
5079 free_extent_map(em); in btrfs_full_stripe_len()
5086 struct extent_map *em; in btrfs_is_parity_mirror() local
5092 em = lookup_extent_mapping(em_tree, logical, len); in btrfs_is_parity_mirror()
5094 BUG_ON(!em); in btrfs_is_parity_mirror()
5096 BUG_ON(em->start > logical || em->start + em->len < logical); in btrfs_is_parity_mirror()
5097 map = (struct map_lookup *)em->bdev; in btrfs_is_parity_mirror()
5100 free_extent_map(em); in btrfs_is_parity_mirror()
5213 struct extent_map *em; in __btrfs_map_block() local
5239 em = lookup_extent_mapping(em_tree, logical, *length); in __btrfs_map_block()
5242 if (!em) { in __btrfs_map_block()
5248 if (em->start > logical || em->start + em->len < logical) { in __btrfs_map_block()
5250 "found %Lu-%Lu", logical, em->start, in __btrfs_map_block()
5251 em->start + em->len); in __btrfs_map_block()
5252 free_extent_map(em); in __btrfs_map_block()
5256 map = (struct map_lookup *)em->bdev; in __btrfs_map_block()
5257 offset = logical - em->start; in __btrfs_map_block()
5292 *length = min_t(u64, em->len - offset, *length); in __btrfs_map_block()
5306 *length = min_t(u64, em->len - offset, max_len); in __btrfs_map_block()
5308 *length = em->len - offset; in __btrfs_map_block()
5547 em->start + (tmp + i) * map->stripe_len; in __btrfs_map_block()
5746 free_extent_map(em); in __btrfs_map_block()
5773 struct extent_map *em; in btrfs_rmap_block() local
5783 em = lookup_extent_mapping(em_tree, chunk_start, 1); in btrfs_rmap_block()
5786 if (!em) { in btrfs_rmap_block()
5792 if (em->start != chunk_start) { in btrfs_rmap_block()
5794 em->start, chunk_start); in btrfs_rmap_block()
5795 free_extent_map(em); in btrfs_rmap_block()
5798 map = (struct map_lookup *)em->bdev; in btrfs_rmap_block()
5800 length = em->len; in btrfs_rmap_block()
5850 free_extent_map(em); in btrfs_rmap_block()
6199 struct extent_map *em; in read_one_chunk() local
6212 em = lookup_extent_mapping(&map_tree->map_tree, logical, 1); in read_one_chunk()
6216 if (em && em->start <= logical && em->start + em->len > logical) { in read_one_chunk()
6217 free_extent_map(em); in read_one_chunk()
6219 } else if (em) { in read_one_chunk()
6220 free_extent_map(em); in read_one_chunk()
6223 em = alloc_extent_map(); in read_one_chunk()
6224 if (!em) in read_one_chunk()
6229 free_extent_map(em); in read_one_chunk()
6233 set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); in read_one_chunk()
6234 em->bdev = (struct block_device *)map; in read_one_chunk()
6235 em->start = logical; in read_one_chunk()
6236 em->len = length; in read_one_chunk()
6237 em->orig_start = 0; in read_one_chunk()
6238 em->block_start = 0; in read_one_chunk()
6239 em->block_len = em->len; in read_one_chunk()
6258 free_extent_map(em); in read_one_chunk()
6266 free_extent_map(em); in read_one_chunk()
6276 ret = add_extent_mapping(&map_tree->map_tree, em, 0); in read_one_chunk()
6279 free_extent_map(em); in read_one_chunk()
6922 struct extent_map *em; in btrfs_update_commit_device_bytes_used() local
6932 list_for_each_entry(em, &transaction->pending_chunks, list) { in btrfs_update_commit_device_bytes_used()
6933 map = (struct map_lookup *)em->bdev; in btrfs_update_commit_device_bytes_used()