Lines Matching refs:em

1059 	struct extent_map *em;  in contains_pending_extent()  local
1065 list_for_each_entry(em, search_list, list) { in contains_pending_extent()
1069 map = (struct map_lookup *)em->bdev; in contains_pending_extent()
1074 map->stripes[i].physical + em->orig_block_len <= in contains_pending_extent()
1078 em->orig_block_len; in contains_pending_extent()
1375 struct extent_map *em; in find_next_chunk() local
1383 em = rb_entry(n, struct extent_map, rb_node); in find_next_chunk()
1384 ret = em->start + em->len; in find_next_chunk()
2585 struct extent_map *em; in btrfs_remove_chunk() local
2597 em = lookup_extent_mapping(em_tree, chunk_offset, 1); in btrfs_remove_chunk()
2600 if (!em || em->start > chunk_offset || in btrfs_remove_chunk()
2601 em->start + em->len < chunk_offset) { in btrfs_remove_chunk()
2608 if (em) in btrfs_remove_chunk()
2609 free_extent_map(em); in btrfs_remove_chunk()
2612 map = (struct map_lookup *)em->bdev; in btrfs_remove_chunk()
2649 trace_btrfs_chunk_free(root, map, chunk_offset, em->len); in btrfs_remove_chunk()
2659 ret = btrfs_remove_block_group(trans, extent_root, chunk_offset, em); in btrfs_remove_chunk()
2667 free_extent_map(em); in btrfs_remove_chunk()
4226 struct extent_map *em; in __btrfs_alloc_chunk() local
4448 em = alloc_extent_map(); in __btrfs_alloc_chunk()
4449 if (!em) { in __btrfs_alloc_chunk()
4454 set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); in __btrfs_alloc_chunk()
4455 em->bdev = (struct block_device *)map; in __btrfs_alloc_chunk()
4456 em->start = start; in __btrfs_alloc_chunk()
4457 em->len = num_bytes; in __btrfs_alloc_chunk()
4458 em->block_start = 0; in __btrfs_alloc_chunk()
4459 em->block_len = em->len; in __btrfs_alloc_chunk()
4460 em->orig_block_len = stripe_size; in __btrfs_alloc_chunk()
4464 ret = add_extent_mapping(em_tree, em, 0); in __btrfs_alloc_chunk()
4466 list_add_tail(&em->list, &trans->transaction->pending_chunks); in __btrfs_alloc_chunk()
4467 atomic_inc(&em->refs); in __btrfs_alloc_chunk()
4471 free_extent_map(em); in __btrfs_alloc_chunk()
4491 free_extent_map(em); in __btrfs_alloc_chunk()
4499 remove_extent_mapping(em_tree, em); in __btrfs_alloc_chunk()
4503 free_extent_map(em); in __btrfs_alloc_chunk()
4505 free_extent_map(em); in __btrfs_alloc_chunk()
4507 free_extent_map(em); in __btrfs_alloc_chunk()
4523 struct extent_map *em; in btrfs_finish_chunk_alloc() local
4533 em = lookup_extent_mapping(em_tree, chunk_offset, chunk_size); in btrfs_finish_chunk_alloc()
4536 if (!em) { in btrfs_finish_chunk_alloc()
4542 if (em->start != chunk_offset || em->len != chunk_size) { in btrfs_finish_chunk_alloc()
4545 chunk_size, em->start, em->len); in btrfs_finish_chunk_alloc()
4546 free_extent_map(em); in btrfs_finish_chunk_alloc()
4550 map = (struct map_lookup *)em->bdev; in btrfs_finish_chunk_alloc()
4552 stripe_size = em->orig_block_len; in btrfs_finish_chunk_alloc()
4613 free_extent_map(em); in btrfs_finish_chunk_alloc()
4679 struct extent_map *em; in btrfs_chunk_readonly() local
4687 em = lookup_extent_mapping(&map_tree->map_tree, chunk_offset, 1); in btrfs_chunk_readonly()
4689 if (!em) in btrfs_chunk_readonly()
4692 map = (struct map_lookup *)em->bdev; in btrfs_chunk_readonly()
4713 free_extent_map(em); in btrfs_chunk_readonly()
4724 struct extent_map *em; in btrfs_mapping_tree_free() local
4728 em = lookup_extent_mapping(&tree->map_tree, 0, (u64)-1); in btrfs_mapping_tree_free()
4729 if (em) in btrfs_mapping_tree_free()
4730 remove_extent_mapping(&tree->map_tree, em); in btrfs_mapping_tree_free()
4732 if (!em) in btrfs_mapping_tree_free()
4735 free_extent_map(em); in btrfs_mapping_tree_free()
4737 free_extent_map(em); in btrfs_mapping_tree_free()
4744 struct extent_map *em; in btrfs_num_copies() local
4750 em = lookup_extent_mapping(em_tree, logical, len); in btrfs_num_copies()
4758 if (!em) { in btrfs_num_copies()
4764 if (em->start > logical || em->start + em->len < logical) { in btrfs_num_copies()
4766 "%Lu-%Lu", logical, logical+len, em->start, in btrfs_num_copies()
4767 em->start + em->len); in btrfs_num_copies()
4768 free_extent_map(em); in btrfs_num_copies()
4772 map = (struct map_lookup *)em->bdev; in btrfs_num_copies()
4783 free_extent_map(em); in btrfs_num_copies()
4797 struct extent_map *em; in btrfs_full_stripe_len() local
4803 em = lookup_extent_mapping(em_tree, logical, len); in btrfs_full_stripe_len()
4805 BUG_ON(!em); in btrfs_full_stripe_len()
4807 BUG_ON(em->start > logical || em->start + em->len < logical); in btrfs_full_stripe_len()
4808 map = (struct map_lookup *)em->bdev; in btrfs_full_stripe_len()
4811 free_extent_map(em); in btrfs_full_stripe_len()
4818 struct extent_map *em; in btrfs_is_parity_mirror() local
4824 em = lookup_extent_mapping(em_tree, logical, len); in btrfs_is_parity_mirror()
4826 BUG_ON(!em); in btrfs_is_parity_mirror()
4828 BUG_ON(em->start > logical || em->start + em->len < logical); in btrfs_is_parity_mirror()
4829 map = (struct map_lookup *)em->bdev; in btrfs_is_parity_mirror()
4832 free_extent_map(em); in btrfs_is_parity_mirror()
4947 struct extent_map *em; in __btrfs_map_block() local
4973 em = lookup_extent_mapping(em_tree, logical, *length); in __btrfs_map_block()
4976 if (!em) { in __btrfs_map_block()
4982 if (em->start > logical || em->start + em->len < logical) { in __btrfs_map_block()
4984 "found %Lu-%Lu", logical, em->start, in __btrfs_map_block()
4985 em->start + em->len); in __btrfs_map_block()
4986 free_extent_map(em); in __btrfs_map_block()
4990 map = (struct map_lookup *)em->bdev; in __btrfs_map_block()
4991 offset = logical - em->start; in __btrfs_map_block()
5026 *length = min_t(u64, em->len - offset, *length); in __btrfs_map_block()
5040 *length = min_t(u64, em->len - offset, max_len); in __btrfs_map_block()
5042 *length = em->len - offset; in __btrfs_map_block()
5281 em->start + (tmp + i) * map->stripe_len; in __btrfs_map_block()
5480 free_extent_map(em); in __btrfs_map_block()
5507 struct extent_map *em; in btrfs_rmap_block() local
5517 em = lookup_extent_mapping(em_tree, chunk_start, 1); in btrfs_rmap_block()
5520 if (!em) { in btrfs_rmap_block()
5526 if (em->start != chunk_start) { in btrfs_rmap_block()
5528 em->start, chunk_start); in btrfs_rmap_block()
5529 free_extent_map(em); in btrfs_rmap_block()
5532 map = (struct map_lookup *)em->bdev; in btrfs_rmap_block()
5534 length = em->len; in btrfs_rmap_block()
5584 free_extent_map(em); in btrfs_rmap_block()
6012 struct extent_map *em; in read_one_chunk() local
6025 em = lookup_extent_mapping(&map_tree->map_tree, logical, 1); in read_one_chunk()
6029 if (em && em->start <= logical && em->start + em->len > logical) { in read_one_chunk()
6030 free_extent_map(em); in read_one_chunk()
6032 } else if (em) { in read_one_chunk()
6033 free_extent_map(em); in read_one_chunk()
6036 em = alloc_extent_map(); in read_one_chunk()
6037 if (!em) in read_one_chunk()
6042 free_extent_map(em); in read_one_chunk()
6046 set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); in read_one_chunk()
6047 em->bdev = (struct block_device *)map; in read_one_chunk()
6048 em->start = logical; in read_one_chunk()
6049 em->len = length; in read_one_chunk()
6050 em->orig_start = 0; in read_one_chunk()
6051 em->block_start = 0; in read_one_chunk()
6052 em->block_len = em->len; in read_one_chunk()
6071 free_extent_map(em); in read_one_chunk()
6079 free_extent_map(em); in read_one_chunk()
6087 ret = add_extent_mapping(&map_tree->map_tree, em, 0); in read_one_chunk()
6090 free_extent_map(em); in read_one_chunk()
6720 struct extent_map *em; in btrfs_update_commit_device_bytes_used() local
6730 list_for_each_entry(em, &transaction->pending_chunks, list) { in btrfs_update_commit_device_bytes_used()
6731 map = (struct map_lookup *)em->bdev; in btrfs_update_commit_device_bytes_used()