summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8933d70c3d53..da7e0e1107d2 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4196,7 +4196,7 @@ static u32 find_raid56_stripe_len(u32 data_devices, u32 dev_stripe_target)
4196 4196
4197static void check_raid56_incompat_flag(struct btrfs_fs_info *info, u64 type) 4197static void check_raid56_incompat_flag(struct btrfs_fs_info *info, u64 type)
4198{ 4198{
4199 if (!(type & (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6))) 4199 if (!(type & BTRFS_BLOCK_GROUP_RAID56_MASK))
4200 return; 4200 return;
4201 4201
4202 btrfs_set_fs_incompat(info, RAID56); 4202 btrfs_set_fs_incompat(info, RAID56);
@@ -4803,10 +4803,8 @@ unsigned long btrfs_full_stripe_len(struct btrfs_root *root,
4803 4803
4804 BUG_ON(em->start > logical || em->start + em->len < logical); 4804 BUG_ON(em->start > logical || em->start + em->len < logical);
4805 map = (struct map_lookup *)em->bdev; 4805 map = (struct map_lookup *)em->bdev;
4806 if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | 4806 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
4807 BTRFS_BLOCK_GROUP_RAID6)) {
4808 len = map->stripe_len * nr_data_stripes(map); 4807 len = map->stripe_len * nr_data_stripes(map);
4809 }
4810 free_extent_map(em); 4808 free_extent_map(em);
4811 return len; 4809 return len;
4812} 4810}
@@ -4826,8 +4824,7 @@ int btrfs_is_parity_mirror(struct btrfs_mapping_tree *map_tree,
4826 4824
4827 BUG_ON(em->start > logical || em->start + em->len < logical); 4825 BUG_ON(em->start > logical || em->start + em->len < logical);
4828 map = (struct map_lookup *)em->bdev; 4826 map = (struct map_lookup *)em->bdev;
4829 if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | 4827 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
4830 BTRFS_BLOCK_GROUP_RAID6))
4831 ret = 1; 4828 ret = 1;
4832 free_extent_map(em); 4829 free_extent_map(em);
4833 return ret; 4830 return ret;
@@ -4998,7 +4995,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
4998 stripe_offset = offset - stripe_offset; 4995 stripe_offset = offset - stripe_offset;
4999 4996
5000 /* if we're here for raid56, we need to know the stripe aligned start */ 4997 /* if we're here for raid56, we need to know the stripe aligned start */
5001 if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)) { 4998 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5002 unsigned long full_stripe_len = stripe_len * nr_data_stripes(map); 4999 unsigned long full_stripe_len = stripe_len * nr_data_stripes(map);
5003 raid56_full_stripe_start = offset; 5000 raid56_full_stripe_start = offset;
5004 5001
@@ -5011,8 +5008,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
5011 5008
5012 if (rw & REQ_DISCARD) { 5009 if (rw & REQ_DISCARD) {
5013 /* we don't discard raid56 yet */ 5010 /* we don't discard raid56 yet */
5014 if (map->type & 5011 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5015 (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)) {
5016 ret = -EOPNOTSUPP; 5012 ret = -EOPNOTSUPP;
5017 goto out; 5013 goto out;
5018 } 5014 }
@@ -5022,7 +5018,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
5022 /* For writes to RAID[56], allow a full stripeset across all disks. 5018 /* For writes to RAID[56], allow a full stripeset across all disks.
5023 For other RAID types and for RAID[56] reads, just allow a single 5019 For other RAID types and for RAID[56] reads, just allow a single
5024 stripe (on a single disk). */ 5020 stripe (on a single disk). */
5025 if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6) && 5021 if ((map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) &&
5026 (rw & REQ_WRITE)) { 5022 (rw & REQ_WRITE)) {
5027 max_len = stripe_len * nr_data_stripes(map) - 5023 max_len = stripe_len * nr_data_stripes(map) -
5028 (offset - raid56_full_stripe_start); 5024 (offset - raid56_full_stripe_start);
@@ -5188,8 +5184,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
5188 mirror_num = stripe_index - old_stripe_index + 1; 5184 mirror_num = stripe_index - old_stripe_index + 1;
5189 } 5185 }
5190 5186
5191 } else if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | 5187 } else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5192 BTRFS_BLOCK_GROUP_RAID6)) {
5193 if (need_raid_map && 5188 if (need_raid_map &&
5194 ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) || 5189 ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) ||
5195 mirror_num > 1)) { 5190 mirror_num > 1)) {
@@ -5253,7 +5248,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
5253 bbio->tgtdev_map = (int *)(bbio->stripes + num_alloc_stripes); 5248 bbio->tgtdev_map = (int *)(bbio->stripes + num_alloc_stripes);
5254 5249
5255 /* build raid_map */ 5250 /* build raid_map */
5256 if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6) && 5251 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK &&
5257 need_raid_map && ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) || 5252 need_raid_map && ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) ||
5258 mirror_num > 1)) { 5253 mirror_num > 1)) {
5259 u64 tmp; 5254 u64 tmp;
@@ -5534,8 +5529,7 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
5534 do_div(length, map->num_stripes / map->sub_stripes); 5529 do_div(length, map->num_stripes / map->sub_stripes);
5535 else if (map->type & BTRFS_BLOCK_GROUP_RAID0) 5530 else if (map->type & BTRFS_BLOCK_GROUP_RAID0)
5536 do_div(length, map->num_stripes); 5531 do_div(length, map->num_stripes);
5537 else if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | 5532 else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5538 BTRFS_BLOCK_GROUP_RAID6)) {
5539 do_div(length, nr_data_stripes(map)); 5533 do_div(length, nr_data_stripes(map));
5540 rmap_len = map->stripe_len * nr_data_stripes(map); 5534 rmap_len = map->stripe_len * nr_data_stripes(map);
5541 } 5535 }