Lines Matching defs:map
1792 n = rb_last(&em_tree->map.rb_root);
3049 "unable to find chunk map for logical %llu length %llu",
3056 "found a bad chunk map, wanted %llu-%llu, found %llu-%llu",
3067 struct map_lookup *map, u64 chunk_offset)
3078 for (i = 0; i < map->num_stripes; i++) {
3081 ret = btrfs_update_device(trans, map->stripes[i].dev);
3093 struct map_lookup *map;
3108 map = em->map_lookup;
3121 for (i = 0; i < map->num_stripes; i++) {
3122 struct btrfs_device *device = map->stripes[i].dev;
3124 map->stripes[i].physical,
3153 * that replaces the device object associated with the map's stripes,
3167 check_system_chunk(trans, map->type);
3169 ret = remove_chunk_item(trans, map, chunk_offset);
3201 ret = remove_chunk_item(trans, map, chunk_offset);
3211 trace_btrfs_chunk_free(fs_info, map, chunk_offset, em->len);
3213 if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
5081 /* sub_stripes info for map */
5380 struct map_lookup *map = NULL;
5390 map = kmalloc(map_lookup_size(ctl->num_stripes), GFP_NOFS);
5391 if (!map)
5393 map->num_stripes = ctl->num_stripes;
5398 map->stripes[s].dev = devices_info[i].dev;
5399 map->stripes[s].physical = devices_info[i].dev_offset +
5403 map->io_align = BTRFS_STRIPE_LEN;
5404 map->io_width = BTRFS_STRIPE_LEN;
5405 map->type = type;
5406 map->sub_stripes = ctl->sub_stripes;
5408 trace_btrfs_chunk_alloc(info, map, start, ctl->chunk_size);
5412 kfree(map);
5416 em->map_lookup = map;
5437 for (i = 0; i < map->num_stripes; i++) {
5438 struct btrfs_device *dev = map->stripes[i].dev;
5447 atomic64_sub(ctl->stripe_size * map->num_stripes,
5543 struct map_lookup *map;
5557 * that replaces the device object associated with the map's stripes,
5579 map = em->map_lookup;
5580 item_size = btrfs_chunk_item_size(map->num_stripes);
5589 for (i = 0; i < map->num_stripes; i++) {
5590 struct btrfs_device *device = map->stripes[i].dev;
5598 for (i = 0; i < map->num_stripes; i++) {
5599 struct btrfs_device *device = map->stripes[i].dev;
5600 const u64 dev_offset = map->stripes[i].physical;
5611 btrfs_set_stack_chunk_type(chunk, map->type);
5612 btrfs_set_stack_chunk_num_stripes(chunk, map->num_stripes);
5616 btrfs_set_stack_chunk_sub_stripes(chunk, map->sub_stripes);
5628 if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
5681 static inline int btrfs_chunk_max_errors(struct map_lookup *map)
5683 const int index = btrfs_bg_flags_to_raid_index(map->type);
5691 struct map_lookup *map;
5700 map = em->map_lookup;
5701 for (i = 0; i < map->num_stripes; i++) {
5703 &map->stripes[i].dev->dev_state)) {
5708 &map->stripes[i].dev->dev_state)) {
5718 if (miss_ndevs > btrfs_chunk_max_errors(map))
5747 struct map_lookup *map;
5761 map = em->map_lookup;
5762 index = btrfs_bg_flags_to_raid_index(map->type);
5765 if (!(map->type & BTRFS_BLOCK_GROUP_RAID56_MASK))
5767 else if (map->type & BTRFS_BLOCK_GROUP_RAID5)
5769 else if (map->type & BTRFS_BLOCK_GROUP_RAID6)
5777 ret = map->num_stripes;
5786 struct map_lookup *map;
5795 map = em->map_lookup;
5796 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
5797 len = btrfs_stripe_nr_to_offset(nr_data_stripes(map));
5806 struct map_lookup *map;
5815 map = em->map_lookup;
5816 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
5824 struct map_lookup *map, int first,
5833 ASSERT((map->type &
5836 if (map->type & BTRFS_BLOCK_GROUP_RAID10)
5837 num_stripes = map->sub_stripes;
5839 num_stripes = map->num_stripes;
5867 if (map->stripes[preferred_mirror].dev->bdev &&
5868 (tolerance || map->stripes[preferred_mirror].dev != srcdev))
5871 if (map->stripes[i].dev->bdev &&
5872 (tolerance || map->stripes[i].dev != srcdev))
5930 struct map_lookup *map;
5952 map = em->map_lookup;
5955 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5985 if (map->type & (BTRFS_BLOCK_GROUP_RAID0 |
5987 if (map->type & BTRFS_BLOCK_GROUP_RAID0)
5990 sub_stripes = map->sub_stripes;
5992 factor = map->num_stripes / sub_stripes;
5993 *num_stripes = min_t(u64, map->num_stripes,
6002 } else if (map->type & (BTRFS_BLOCK_GROUP_RAID1_MASK |
6004 *num_stripes = map->num_stripes;
6006 stripe_index = stripe_nr % map->num_stripes;
6007 stripe_nr /= map->num_stripes;
6018 map->stripes[stripe_index].physical +
6020 stripes[i].dev = map->stripes[stripe_index].dev;
6022 if (map->type & (BTRFS_BLOCK_GROUP_RAID0 |
6052 if (stripe_index == map->num_stripes) {
6159 static u64 btrfs_max_io_len(struct map_lookup *map, enum btrfs_map_op op,
6171 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
6173 btrfs_stripe_nr_to_offset(nr_data_stripes(map));
6186 rounddown(*stripe_nr, nr_data_stripes(map)));
6202 if (map->type & BTRFS_BLOCK_GROUP_STRIPE_MASK)
6207 static void set_io_stripe(struct btrfs_io_stripe *dst, const struct map_lookup *map,
6210 dst->dev = map->stripes[stripe_index].dev;
6211 dst->physical = map->stripes[stripe_index].physical +
6229 * If the map request can be fulfilled by one single
6250 * @need_raid_map: (Used only for integrity checker) whether the map wants
6251 * a full stripe map (including all data and P/Q stripes)
6261 struct map_lookup *map;
6290 map = em->map_lookup;
6291 data_stripes = nr_data_stripes(map);
6294 max_len = btrfs_max_io_len(map, op, map_offset, &stripe_nr,
6309 if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
6310 stripe_index = stripe_nr % map->num_stripes;
6311 stripe_nr /= map->num_stripes;
6314 } else if (map->type & BTRFS_BLOCK_GROUP_RAID1_MASK) {
6316 num_stripes = map->num_stripes;
6320 stripe_index = find_live_mirror(fs_info, map, 0,
6325 } else if (map->type & BTRFS_BLOCK_GROUP_DUP) {
6327 num_stripes = map->num_stripes;
6334 } else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
6335 u32 factor = map->num_stripes / map->sub_stripes;
6337 stripe_index = (stripe_nr % factor) * map->sub_stripes;
6341 num_stripes = map->sub_stripes;
6346 stripe_index = find_live_mirror(fs_info, map,
6352 } else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
6366 num_stripes = map->num_stripes;
6367 max_errors = btrfs_chunk_max_errors(map);
6388 stripe_index = (stripe_nr + stripe_index) % map->num_stripes;
6398 stripe_index = stripe_nr % map->num_stripes;
6399 stripe_nr /= map->num_stripes;
6402 if (stripe_index >= map->num_stripes) {
6405 stripe_index, map->num_stripes);
6428 !((map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) && mirror_num > 1)) {
6429 set_io_stripe(smap, map, stripe_index, stripe_offset, stripe_nr);
6442 bioc->map_type = map->type;
6445 * For RAID56 full map, we need to make sure the stripes[] follows the
6451 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK && need_raid_map &&
6464 set_io_stripe(&bioc->stripes[i], map,
6473 set_io_stripe(&bioc->stripes[i], map, stripe_index,
6480 max_errors = btrfs_chunk_max_errors(map);
6673 const struct map_lookup *map = em->map_lookup;
6674 const int data_stripes = calc_data_stripes(map->type, map->num_stripes);
6746 struct map_lookup *map;
6796 map = kmalloc(map_lookup_size(num_stripes), GFP_NOFS);
6797 if (!map) {
6803 em->map_lookup = map;
6810 map->num_stripes = num_stripes;
6811 map->io_width = btrfs_chunk_io_width(leaf, chunk);
6812 map->io_align = btrfs_chunk_io_align(leaf, chunk);
6813 map->type = type;
6822 map->sub_stripes = btrfs_raid_array[index].sub_stripes;
6823 map->verified_stripes = 0;
6826 map->stripes[i].physical =
6834 map->stripes[i].dev = btrfs_find_device(fs_info->fs_devices, &args);
6835 if (!map->stripes[i].dev) {
6836 map->stripes[i].dev = handle_missing_device(fs_info,
6838 if (IS_ERR(map->stripes[i].dev)) {
6839 ret = PTR_ERR(map->stripes[i].dev);
6846 &(map->stripes[i].dev->dev_state));
6854 "failed to add chunk map, start=%llu len=%llu: %d",
7181 struct map_lookup *map;
7186 map = em->map_lookup;
7189 map->type);
7190 for (i = 0; i < map->num_stripes; i++) {
7191 struct btrfs_device *dev = map->stripes[i].dev;
7710 struct map_lookup *map;
7729 map = em->map_lookup;
7750 for (i = 0; i < map->num_stripes; i++) {
7751 if (map->stripes[i].dev->devid == devid &&
7752 map->stripes[i].physical == physical_offset) {
7754 if (map->verified_stripes >= map->num_stripes) {
7761 map->verified_stripes++;
7815 for (node = rb_first_cached(&em_tree->map); node; node = rb_next(node)) {
8084 /* The map range should not cross stripe boundary. */