btrfs-progs: use profile_supported in mkfs as well

Currently we have two places checking if a block-group profile is
supported on a zoned device, one in mkfs/main.c and one in
kernel-shared/zoned.c.

Use the one from kernel-shared/zoned.c in mkfs as well, unifying all
checks.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Johannes Thumshirn 2022-01-26 01:04:02 -08:00 committed by David Sterba
parent e40f476bbb
commit 88895a920f
3 changed files with 5 additions and 4 deletions

View File

@ -808,7 +808,7 @@ out:
return ret; return ret;
} }
static bool profile_supported(u64 flags) bool zoned_profile_supported(u64 flags)
{ {
flags &= BTRFS_BLOCK_GROUP_PROFILE_MASK; flags &= BTRFS_BLOCK_GROUP_PROFILE_MASK;
@ -930,7 +930,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_fs_info *fs_info,
} }
} }
if (!profile_supported(map->type)) { if (!zoned_profile_supported(map->type)) {
error("zoned: profile %s not yet supported", error("zoned: profile %s not yet supported",
btrfs_group_profile_str(map->type)); btrfs_group_profile_str(map->type));
ret = -EINVAL; ret = -EINVAL;

View File

@ -118,6 +118,7 @@ static inline bool btrfs_dev_is_empty_zone(struct btrfs_device *device, u64 pos)
return zinfo->zones[zno].cond == BLK_ZONE_COND_EMPTY; return zinfo->zones[zno].cond == BLK_ZONE_COND_EMPTY;
} }
bool zoned_profile_supported(u64 flags);
int btrfs_reset_dev_zone(int fd, struct blk_zone *zone); int btrfs_reset_dev_zone(int fd, struct blk_zone *zone);
u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start, u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start,
u64 hole_end, u64 num_bytes); u64 hole_end, u64 num_bytes);

View File

@ -1349,8 +1349,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
if (ret) if (ret)
goto error; goto error;
if (zoned && ((metadata_profile | data_profile) & if (zoned && (!zoned_profile_supported(metadata_profile) ||
BTRFS_BLOCK_GROUP_PROFILE_MASK)) { !zoned_profile_supported(data_profile))) {
error("zoned mode does not yet support RAID/DUP profiles, please specify '-d single -m single' manually"); error("zoned mode does not yet support RAID/DUP profiles, please specify '-d single -m single' manually");
goto error; goto error;
} }