@@ -775,7 +775,7 @@ out:
return ret;
}
-bool zoned_profile_supported(u64 map_type)
+bool zoned_profile_supported(u64 map_type, bool rst)
{
bool data = (map_type & BTRFS_BLOCK_GROUP_DATA);
u64 flags = (map_type & BTRFS_BLOCK_GROUP_PROFILE_MASK);
@@ -784,9 +784,18 @@ bool zoned_profile_supported(u64 map_type)
if (flags == 0)
return true;
- /* We can support DUP on metadata */
- if (!data && (flags & BTRFS_BLOCK_GROUP_DUP))
- return true;
+ if (data) {
+ /* Data RAID1 needs a raid-stripe-tree */
+ if ((flags & BTRFS_BLOCK_GROUP_RAID1_MASK) && rst)
+ return true;
+ } else {
+ /* We can support DUP on metadata/system */
+ if (flags & BTRFS_BLOCK_GROUP_DUP)
+ return true;
+ /* We can support RAID1 on metadata/system */
+ if (flags & BTRFS_BLOCK_GROUP_RAID1_MASK)
+ return true;
+ }
/* All other profiles are not supported yet */
return false;
@@ -903,7 +912,8 @@ int btrfs_load_block_group_zone_info(struct btrfs_fs_info *fs_info,
}
}
- if (!zoned_profile_supported(map->type)) {
+ // XXX: not sure how to do yet
+ if (!zoned_profile_supported(map->type, true)) {
error("zoned: profile %s not yet supported",
btrfs_group_profile_str(map->type));
ret = -EINVAL;
@@ -132,7 +132,7 @@ static inline bool btrfs_dev_is_empty_zone(struct btrfs_device *device, u64 pos)
return zinfo->zones[zno].cond == BLK_ZONE_COND_EMPTY;
}
-bool zoned_profile_supported(u64 map_type);
+bool zoned_profile_supported(u64 map_type, bool rst);
int btrfs_reset_dev_zone(int fd, struct blk_zone *zone);
u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start,
u64 hole_end, u64 num_bytes);
@@ -213,7 +213,7 @@ static inline int btrfs_wipe_temporary_sb(struct btrfs_fs_devices *fs_devices)
return 0;
}
-static inline bool zoned_profile_supported(u64 map_type)
+static inline bool zoned_profile_supported(u64 map_type, bool rst)
{
return false;
}
@@ -1424,8 +1424,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
if (ret)
goto error;
- if (zoned && (!zoned_profile_supported(BTRFS_BLOCK_GROUP_METADATA | metadata_profile) ||
- !zoned_profile_supported(BTRFS_BLOCK_GROUP_DATA | data_profile))) {
+ if (zoned && (!zoned_profile_supported(BTRFS_BLOCK_GROUP_METADATA | metadata_profile, runtime_features & BTRFS_RUNTIME_FEATURE_RAID_STRIPE_TREE) ||
+ !zoned_profile_supported(BTRFS_BLOCK_GROUP_DATA | data_profile, runtime_features & BTRFS_RUNTIME_FEATURE_RAID_STRIPE_TREE))) {
error("zoned mode does not yet support RAID/DUP profiles, please specify '-d single -m single' manually");
goto error;
}
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- kernel-shared/zoned.c | 20 +++++++++++++++----- kernel-shared/zoned.h | 4 ++-- mkfs/main.c | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-)