Lines Matching refs:io_geom

6124 				      struct btrfs_io_geometry *io_geom)  in handle_ops_on_dev_replace()  argument
6131 int num_stripes = io_geom->num_stripes; in handle_ops_on_dev_replace()
6132 int max_errors = io_geom->max_errors; in handle_ops_on_dev_replace()
6174 if (io_geom->op == BTRFS_MAP_GET_READ_MIRRORS && nr_extra_stripes == 2) { in handle_ops_on_dev_replace()
6192 io_geom->num_stripes = num_stripes + nr_extra_stripes; in handle_ops_on_dev_replace()
6193 io_geom->max_errors = max_errors + nr_extra_stripes; in handle_ops_on_dev_replace()
6198 struct btrfs_io_geometry *io_geom) in btrfs_max_io_len() argument
6204 io_geom->stripe_offset = offset & BTRFS_STRIPE_LEN_MASK; in btrfs_max_io_len()
6205 io_geom->stripe_nr = offset >> BTRFS_STRIPE_LEN_SHIFT; in btrfs_max_io_len()
6206 ASSERT(io_geom->stripe_offset < U32_MAX); in btrfs_max_io_len()
6221 io_geom->raid56_full_stripe_start = btrfs_stripe_nr_to_offset( in btrfs_max_io_len()
6222 rounddown(io_geom->stripe_nr, nr_data_stripes(map))); in btrfs_max_io_len()
6224 ASSERT(io_geom->raid56_full_stripe_start + full_stripe_len > offset); in btrfs_max_io_len()
6225 ASSERT(io_geom->raid56_full_stripe_start <= offset); in btrfs_max_io_len()
6230 if (io_geom->op == BTRFS_MAP_WRITE) in btrfs_max_io_len()
6231 return full_stripe_len - (offset - io_geom->raid56_full_stripe_start); in btrfs_max_io_len()
6239 return BTRFS_STRIPE_LEN - io_geom->stripe_offset; in btrfs_max_io_len()
6246 struct btrfs_io_geometry *io_geom) in set_io_stripe() argument
6248 dst->dev = map->stripes[io_geom->stripe_index].dev; in set_io_stripe()
6250 if (io_geom->op == BTRFS_MAP_READ && in set_io_stripe()
6254 io_geom->stripe_index, dst); in set_io_stripe()
6256 dst->physical = map->stripes[io_geom->stripe_index].physical + in set_io_stripe()
6257 io_geom->stripe_offset + in set_io_stripe()
6258 btrfs_stripe_nr_to_offset(io_geom->stripe_nr); in set_io_stripe()
6284 struct btrfs_io_geometry *io_geom) in map_blocks_raid0() argument
6286 io_geom->stripe_index = io_geom->stripe_nr % map->num_stripes; in map_blocks_raid0()
6287 io_geom->stripe_nr /= map->num_stripes; in map_blocks_raid0()
6288 if (io_geom->op == BTRFS_MAP_READ) in map_blocks_raid0()
6289 io_geom->mirror_num = 1; in map_blocks_raid0()
6294 struct btrfs_io_geometry *io_geom, in map_blocks_raid1() argument
6297 if (io_geom->op != BTRFS_MAP_READ) { in map_blocks_raid1()
6298 io_geom->num_stripes = map->num_stripes; in map_blocks_raid1()
6302 if (io_geom->mirror_num) { in map_blocks_raid1()
6303 io_geom->stripe_index = io_geom->mirror_num - 1; in map_blocks_raid1()
6307 io_geom->stripe_index = find_live_mirror(fs_info, map, 0, in map_blocks_raid1()
6309 io_geom->mirror_num = io_geom->stripe_index + 1; in map_blocks_raid1()
6313 struct btrfs_io_geometry *io_geom) in map_blocks_dup() argument
6315 if (io_geom->op != BTRFS_MAP_READ) { in map_blocks_dup()
6316 io_geom->num_stripes = map->num_stripes; in map_blocks_dup()
6320 if (io_geom->mirror_num) { in map_blocks_dup()
6321 io_geom->stripe_index = io_geom->mirror_num - 1; in map_blocks_dup()
6325 io_geom->mirror_num = 1; in map_blocks_dup()
6330 struct btrfs_io_geometry *io_geom, in map_blocks_raid10() argument
6336 io_geom->stripe_index = (io_geom->stripe_nr % factor) * map->sub_stripes; in map_blocks_raid10()
6337 io_geom->stripe_nr /= factor; in map_blocks_raid10()
6339 if (io_geom->op != BTRFS_MAP_READ) { in map_blocks_raid10()
6340 io_geom->num_stripes = map->sub_stripes; in map_blocks_raid10()
6344 if (io_geom->mirror_num) { in map_blocks_raid10()
6345 io_geom->stripe_index += io_geom->mirror_num - 1; in map_blocks_raid10()
6349 old_stripe_index = io_geom->stripe_index; in map_blocks_raid10()
6350 io_geom->stripe_index = find_live_mirror(fs_info, map, in map_blocks_raid10()
6351 io_geom->stripe_index, in map_blocks_raid10()
6353 io_geom->mirror_num = io_geom->stripe_index - old_stripe_index + 1; in map_blocks_raid10()
6357 struct btrfs_io_geometry *io_geom, in map_blocks_raid56_write() argument
6372 io_geom->stripe_nr /= data_stripes; in map_blocks_raid56_write()
6375 io_geom->num_stripes = map->num_stripes; in map_blocks_raid56_write()
6376 io_geom->max_errors = btrfs_chunk_max_errors(map); in map_blocks_raid56_write()
6380 io_geom->raid56_full_stripe_start + map->start + in map_blocks_raid56_write()
6383 io_geom->stripe_index = 0; in map_blocks_raid56_write()
6384 io_geom->stripe_offset = 0; in map_blocks_raid56_write()
6388 struct btrfs_io_geometry *io_geom) in map_blocks_raid56_read() argument
6392 ASSERT(io_geom->mirror_num <= 1); in map_blocks_raid56_read()
6394 io_geom->stripe_index = io_geom->stripe_nr % data_stripes; in map_blocks_raid56_read()
6395 io_geom->stripe_nr /= data_stripes; in map_blocks_raid56_read()
6398 io_geom->stripe_index = in map_blocks_raid56_read()
6399 (io_geom->stripe_nr + io_geom->stripe_index) % map->num_stripes; in map_blocks_raid56_read()
6401 if (io_geom->op == BTRFS_MAP_READ && io_geom->mirror_num < 1) in map_blocks_raid56_read()
6402 io_geom->mirror_num = 1; in map_blocks_raid56_read()
6406 struct btrfs_io_geometry *io_geom) in map_blocks_single() argument
6408 io_geom->stripe_index = io_geom->stripe_nr % map->num_stripes; in map_blocks_single()
6409 io_geom->stripe_nr /= map->num_stripes; in map_blocks_single()
6410 io_geom->mirror_num = io_geom->stripe_index + 1; in map_blocks_single()
6454 struct btrfs_io_geometry io_geom = { 0 }; in btrfs_map_block() local
6466 io_geom.mirror_num = (mirror_num_ret ? *mirror_num_ret : 0); in btrfs_map_block()
6467 io_geom.num_stripes = 1; in btrfs_map_block()
6468 io_geom.stripe_index = 0; in btrfs_map_block()
6469 io_geom.op = op; in btrfs_map_block()
6476 if (io_geom.mirror_num > num_copies) in btrfs_map_block()
6480 io_geom.raid56_full_stripe_start = (u64)-1; in btrfs_map_block()
6481 max_len = btrfs_max_io_len(map, map_offset, &io_geom); in btrfs_map_block()
6495 map_blocks_raid0(map, &io_geom); in btrfs_map_block()
6500 map_blocks_raid1(fs_info, map, &io_geom, dev_replace_is_ongoing); in btrfs_map_block()
6503 map_blocks_dup(map, &io_geom); in btrfs_map_block()
6506 map_blocks_raid10(fs_info, map, &io_geom, dev_replace_is_ongoing); in btrfs_map_block()
6510 if (op != BTRFS_MAP_READ || io_geom.mirror_num > 1) in btrfs_map_block()
6511 map_blocks_raid56_write(map, &io_geom, logical, length); in btrfs_map_block()
6513 map_blocks_raid56_read(map, &io_geom); in btrfs_map_block()
6521 map_blocks_single(map, &io_geom); in btrfs_map_block()
6524 if (io_geom.stripe_index >= map->num_stripes) { in btrfs_map_block()
6527 io_geom.stripe_index, map->num_stripes); in btrfs_map_block()
6532 num_alloc_stripes = io_geom.num_stripes; in btrfs_map_block()
6550 io_geom.mirror_num)) { in btrfs_map_block()
6551 ret = set_io_stripe(fs_info, logical, length, smap, map, &io_geom); in btrfs_map_block()
6553 *mirror_num_ret = io_geom.mirror_num; in btrfs_map_block()
6573 (op != BTRFS_MAP_READ || io_geom.mirror_num > 1)) { in btrfs_map_block()
6583 btrfs_stripe_nr_to_offset(io_geom.stripe_nr * in btrfs_map_block()
6585 for (int i = 0; i < io_geom.num_stripes; i++) { in btrfs_map_block()
6589 stripe_index = (i + io_geom.stripe_nr) % io_geom.num_stripes; in btrfs_map_block()
6593 io_geom.stripe_offset + in btrfs_map_block()
6594 btrfs_stripe_nr_to_offset(io_geom.stripe_nr); in btrfs_map_block()
6601 for (int i = 0; i < io_geom.num_stripes; i++) { in btrfs_map_block()
6603 &bioc->stripes[i], map, &io_geom); in btrfs_map_block()
6606 io_geom.stripe_index++; in btrfs_map_block()
6617 io_geom.max_errors = btrfs_chunk_max_errors(map); in btrfs_map_block()
6621 handle_ops_on_dev_replace(bioc, dev_replace, logical, &io_geom); in btrfs_map_block()
6625 bioc->num_stripes = io_geom.num_stripes; in btrfs_map_block()
6626 bioc->max_errors = io_geom.max_errors; in btrfs_map_block()
6627 bioc->mirror_num = io_geom.mirror_num; in btrfs_map_block()