|
@@ -4103,7 +4103,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
|
|
|
stripe_nr_end - stripe_nr_orig);
|
|
|
stripe_index = do_div(stripe_nr, map->num_stripes);
|
|
|
} else if (map->type & BTRFS_BLOCK_GROUP_RAID1) {
|
|
|
- if (rw & (REQ_WRITE | REQ_DISCARD))
|
|
|
+ if (rw & (REQ_WRITE | REQ_DISCARD | REQ_GET_READ_MIRRORS))
|
|
|
num_stripes = map->num_stripes;
|
|
|
else if (mirror_num)
|
|
|
stripe_index = mirror_num - 1;
|
|
@@ -4115,7 +4115,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
|
|
|
}
|
|
|
|
|
|
} else if (map->type & BTRFS_BLOCK_GROUP_DUP) {
|
|
|
- if (rw & (REQ_WRITE | REQ_DISCARD)) {
|
|
|
+ if (rw & (REQ_WRITE | REQ_DISCARD | REQ_GET_READ_MIRRORS)) {
|
|
|
num_stripes = map->num_stripes;
|
|
|
} else if (mirror_num) {
|
|
|
stripe_index = mirror_num - 1;
|
|
@@ -4129,7 +4129,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
|
|
|
stripe_index = do_div(stripe_nr, factor);
|
|
|
stripe_index *= map->sub_stripes;
|
|
|
|
|
|
- if (rw & REQ_WRITE)
|
|
|
+ if (rw & (REQ_WRITE | REQ_GET_READ_MIRRORS))
|
|
|
num_stripes = map->sub_stripes;
|
|
|
else if (rw & REQ_DISCARD)
|
|
|
num_stripes = min_t(u64, map->sub_stripes *
|
|
@@ -4242,7 +4242,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (rw & REQ_WRITE) {
|
|
|
+ if (rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) {
|
|
|
if (map->type & (BTRFS_BLOCK_GROUP_RAID1 |
|
|
|
BTRFS_BLOCK_GROUP_RAID10 |
|
|
|
BTRFS_BLOCK_GROUP_DUP)) {
|