Lines Matching defs:map
1826 n = rb_last(&em_tree->map.rb_root);
2997 "unable to find chunk map for logical %llu length %llu",
3004 "found a bad chunk map, wanted %llu-%llu, found %llu-%llu",
3018 struct map_lookup *map;
3033 map = em->map_lookup;
3035 check_system_chunk(trans, map->type);
3041 * with map stripes (dev-replace.c:btrfs_dev_replace_finishing()).
3044 for (i = 0; i < map->num_stripes; i++) {
3045 struct btrfs_device *device = map->stripes[i].dev;
3047 map->stripes[i].physical,
3079 trace_btrfs_chunk_free(fs_info, map, chunk_offset, em->len);
3081 if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
4920 /* sub_stripes info for map */
5156 struct map_lookup *map = NULL;
5165 map = kmalloc(map_lookup_size(ctl->num_stripes), GFP_NOFS);
5166 if (!map)
5168 map->num_stripes = ctl->num_stripes;
5173 map->stripes[s].dev = devices_info[i].dev;
5174 map->stripes[s].physical = devices_info[i].dev_offset +
5178 map->stripe_len = BTRFS_STRIPE_LEN;
5179 map->io_align = BTRFS_STRIPE_LEN;
5180 map->io_width = BTRFS_STRIPE_LEN;
5181 map->type = type;
5182 map->sub_stripes = ctl->sub_stripes;
5184 trace_btrfs_chunk_alloc(info, map, start, ctl->chunk_size);
5188 kfree(map);
5192 em->map_lookup = map;
5213 for (i = 0; i < map->num_stripes; i++) {
5214 struct btrfs_device *dev = map->stripes[i].dev;
5223 atomic64_sub(ctl->stripe_size * map->num_stripes,
5314 struct map_lookup *map;
5325 map = em->map_lookup;
5326 item_size = btrfs_chunk_item_size(map->num_stripes);
5338 * with the map's stripes, because the device object's id can change
5343 for (i = 0; i < map->num_stripes; i++) {
5344 device = map->stripes[i].dev;
5345 dev_offset = map->stripes[i].physical;
5361 for (i = 0; i < map->num_stripes; i++) {
5362 device = map->stripes[i].dev;
5363 dev_offset = map->stripes[i].physical;
5374 btrfs_set_stack_chunk_stripe_len(chunk, map->stripe_len);
5375 btrfs_set_stack_chunk_type(chunk, map->type);
5376 btrfs_set_stack_chunk_num_stripes(chunk, map->num_stripes);
5377 btrfs_set_stack_chunk_io_align(chunk, map->stripe_len);
5378 btrfs_set_stack_chunk_io_width(chunk, map->stripe_len);
5380 btrfs_set_stack_chunk_sub_stripes(chunk, map->sub_stripes);
5387 if (ret == 0 && map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
5417 static inline int btrfs_chunk_max_errors(struct map_lookup *map)
5419 const int index = btrfs_bg_flags_to_raid_index(map->type);
5427 struct map_lookup *map;
5436 map = em->map_lookup;
5437 for (i = 0; i < map->num_stripes; i++) {
5439 &map->stripes[i].dev->dev_state)) {
5444 &map->stripes[i].dev->dev_state)) {
5455 if (miss_ndevs > btrfs_chunk_max_errors(map))
5484 struct map_lookup *map;
5497 map = em->map_lookup;
5498 if (map->type & (BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID1_MASK))
5499 ret = map->num_stripes;
5500 else if (map->type & BTRFS_BLOCK_GROUP_RAID10)
5501 ret = map->sub_stripes;
5502 else if (map->type & BTRFS_BLOCK_GROUP_RAID5)
5504 else if (map->type & BTRFS_BLOCK_GROUP_RAID6)
5512 ret = map->num_stripes;
5530 struct map_lookup *map;
5536 map = em->map_lookup;
5537 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
5538 len = map->stripe_len * nr_data_stripes(map);
5547 struct map_lookup *map;
5553 map = em->map_lookup;
5554 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
5562 struct map_lookup *map, int first,
5571 ASSERT((map->type &
5574 if (map->type & BTRFS_BLOCK_GROUP_RAID10)
5575 num_stripes = map->sub_stripes;
5577 num_stripes = map->num_stripes;
5594 if (map->stripes[preferred_mirror].dev->bdev &&
5595 (tolerance || map->stripes[preferred_mirror].dev != srcdev))
5598 if (map->stripes[i].dev->bdev &&
5599 (tolerance || map->stripes[i].dev != srcdev))
5678 struct map_lookup *map;
5705 map = em->map_lookup;
5707 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5716 stripe_len = map->stripe_len;
5726 stripe_nr_end = round_up(offset + length, map->stripe_len);
5727 stripe_nr_end = div64_u64(stripe_nr_end, map->stripe_len);
5729 stripe_end_offset = stripe_nr_end * map->stripe_len -
5738 if (map->type & (BTRFS_BLOCK_GROUP_RAID0 |
5740 if (map->type & BTRFS_BLOCK_GROUP_RAID0)
5743 sub_stripes = map->sub_stripes;
5745 factor = map->num_stripes / sub_stripes;
5746 num_stripes = min_t(u64, map->num_stripes,
5754 } else if (map->type & (BTRFS_BLOCK_GROUP_RAID1_MASK |
5756 num_stripes = map->num_stripes;
5758 stripe_nr = div_u64_rem(stripe_nr, map->num_stripes,
5770 map->stripes[stripe_index].physical +
5771 stripe_offset + stripe_nr * map->stripe_len;
5772 bbio->stripes[i].dev = map->stripes[stripe_index].dev;
5774 if (map->type & (BTRFS_BLOCK_GROUP_RAID0 |
5777 map->stripe_len;
5781 map->stripe_len;
5808 if (stripe_index == map->num_stripes) {
5815 bbio->map_type = map->type;
6016 struct map_lookup *map;
6031 map = em->map_lookup;
6035 stripe_len = map->stripe_len;
6050 data_stripes = nr_data_stripes(map);
6052 if (map->type & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
6058 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
6105 struct map_lookup *map;
6134 map = em->map_lookup;
6141 data_stripes = nr_data_stripes(map);
6152 if (dev_replace_is_ongoing && mirror_num == map->num_stripes + 1 &&
6162 } else if (mirror_num > map->num_stripes) {
6168 if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
6169 stripe_nr = div_u64_rem(stripe_nr, map->num_stripes,
6173 } else if (map->type & BTRFS_BLOCK_GROUP_RAID1_MASK) {
6175 num_stripes = map->num_stripes;
6179 stripe_index = find_live_mirror(fs_info, map, 0,
6184 } else if (map->type & BTRFS_BLOCK_GROUP_DUP) {
6186 num_stripes = map->num_stripes;
6193 } else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
6194 u32 factor = map->num_stripes / map->sub_stripes;
6197 stripe_index *= map->sub_stripes;
6200 num_stripes = map->sub_stripes;
6205 stripe_index = find_live_mirror(fs_info, map,
6211 } else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
6218 num_stripes = map->num_stripes;
6219 max_errors = nr_parity_stripes(map);
6221 *length = map->stripe_len;
6236 div_u64_rem(stripe_nr + stripe_index, map->num_stripes,
6247 stripe_nr = div_u64_rem(stripe_nr, map->num_stripes,
6251 if (stripe_index >= map->num_stripes) {
6254 stripe_index, map->num_stripes);
6275 bbio->stripes[i].physical = map->stripes[stripe_index].physical +
6276 stripe_offset + stripe_nr * map->stripe_len;
6277 bbio->stripes[i].dev = map->stripes[stripe_index].dev;
6282 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK && need_raid_map &&
6294 em->start + (tmp + i) * map->stripe_len;
6296 bbio->raid_map[(i+rot) % map->num_stripes] = RAID5_P_STRIPE;
6297 if (map->type & BTRFS_BLOCK_GROUP_RAID6)
6305 max_errors = btrfs_chunk_max_errors(map);
6314 bbio->map_type = map->type;
6328 bbio->mirror_num = map->num_stripes + 1;
6685 struct map_lookup *map;
6724 map = kmalloc(map_lookup_size(num_stripes), GFP_NOFS);
6725 if (!map) {
6731 em->map_lookup = map;
6738 map->num_stripes = num_stripes;
6739 map->io_width = btrfs_chunk_io_width(leaf, chunk);
6740 map->io_align = btrfs_chunk_io_align(leaf, chunk);
6741 map->stripe_len = btrfs_chunk_stripe_len(leaf, chunk);
6742 map->type = btrfs_chunk_type(leaf, chunk);
6743 map->sub_stripes = btrfs_chunk_sub_stripes(leaf, chunk);
6744 map->verified_stripes = 0;
6745 em->orig_block_len = calc_stripe_length(map->type, em->len,
6746 map->num_stripes);
6748 map->stripes[i].physical =
6754 map->stripes[i].dev = btrfs_find_device(fs_info->fs_devices,
6756 if (!map->stripes[i].dev &&
6762 if (!map->stripes[i].dev) {
6763 map->stripes[i].dev =
6766 if (IS_ERR(map->stripes[i].dev)) {
6770 devid, PTR_ERR(map->stripes[i].dev));
6771 return PTR_ERR(map->stripes[i].dev);
6776 &(map->stripes[i].dev->dev_state));
6785 "failed to add chunk map, start=%llu len=%llu: %d",
7114 struct map_lookup *map;
7119 map = em->map_lookup;
7122 map->type);
7123 for (i = 0; i < map->num_stripes; i++) {
7124 struct btrfs_device *dev = map->stripes[i].dev;
7630 struct map_lookup *map;
7649 map = em->map_lookup;
7650 stripe_len = calc_stripe_length(map->type, em->len, map->num_stripes);
7660 for (i = 0; i < map->num_stripes; i++) {
7661 if (map->stripes[i].dev->devid == devid &&
7662 map->stripes[i].physical == physical_offset) {
7664 if (map->verified_stripes >= map->num_stripes) {
7671 map->verified_stripes++;
7726 for (node = rb_first_cached(&em_tree->map); node; node = rb_next(node)) {