@@ -1092,6 +1092,39 @@ static int btrfs_load_block_group_raid0(struct btrfs_fs_info *fs_info,
1092
1092
return 0 ;
1093
1093
}
1094
1094
1095
+ static int btrfs_load_block_group_raid10 (struct btrfs_fs_info * fs_info ,
1096
+ struct btrfs_block_group * bg ,
1097
+ struct map_lookup * map ,
1098
+ struct zone_info * zone_info ,
1099
+ unsigned long * active )
1100
+ {
1101
+ if ((map -> type & BTRFS_BLOCK_GROUP_DATA ) && !fs_info -> stripe_root ) {
1102
+ btrfs_err (fs_info , "zoned: data %s needs raid-stripe-tree" ,
1103
+ btrfs_bg_type_to_raid_name (map -> type ));
1104
+ return - EINVAL ;
1105
+ }
1106
+
1107
+ for (int i = 0 ; i < map -> num_stripes ; i ++ ) {
1108
+ if (zone_info [i ].alloc_offset == WP_MISSING_DEV ||
1109
+ zone_info [i ].alloc_offset == WP_CONVENTIONAL )
1110
+ continue ;
1111
+
1112
+ if (test_bit (0 , active ) != test_bit (i , active )) {
1113
+ return - EIO ;
1114
+ } else {
1115
+ if (test_bit (0 , active ))
1116
+ bg -> zone_is_active = 1 ;
1117
+ }
1118
+
1119
+ if ((i % map -> sub_stripes ) == 0 ) {
1120
+ bg -> zone_capacity += zone_info [i ].capacity ;
1121
+ bg -> alloc_offset += zone_info [i ].alloc_offset ;
1122
+ }
1123
+ }
1124
+
1125
+ return 0 ;
1126
+ }
1127
+
1095
1128
int btrfs_load_block_group_zone_info (struct btrfs_fs_info * fs_info ,
1096
1129
struct btrfs_block_group * cache )
1097
1130
{
@@ -1192,8 +1225,8 @@ int btrfs_load_block_group_zone_info(struct btrfs_fs_info *fs_info,
1192
1225
ret = btrfs_load_block_group_raid0 (fs_info , cache , map , zone_info , active );
1193
1226
break ;
1194
1227
case BTRFS_BLOCK_GROUP_RAID10 :
1195
- /* Temporarily fails these case, until following commits. */
1196
- fallthrough ;
1228
+ ret = btrfs_load_block_group_raid10 ( fs_info , cache , map , zone_info , active );
1229
+ break ;
1197
1230
case BTRFS_BLOCK_GROUP_RAID5 :
1198
1231
case BTRFS_BLOCK_GROUP_RAID6 :
1199
1232
default :
0 commit comments