btrfs: zoned: fix btrfs_can_activate_zone() to support DUP profile
authorNaohiro Aota <naohiro.aota@wdc.com>
Mon, 13 Mar 2023 07:29:49 +0000 (16:29 +0900)
committerDavid Sterba <dsterba@suse.com>
Wed, 15 Mar 2023 19:51:06 +0000 (20:51 +0100)
commit9e1cdf0c354e46e428c0e0cab008abbe81b6013d
tree592172299e540456ef69a19e247c91557102050b
parent10a8857a1beaa015efba7d56e06243d484549fb6
btrfs: zoned: fix btrfs_can_activate_zone() to support DUP profile

btrfs_can_activate_zone() returns true if at least one device has one zone
available for activation. This is OK for the single profile, but not OK for
DUP profile. We need two zones to create a DUP block group. Fix it by
properly handling the case with the profile flags.

Fixes: 265f7237dd25 ("btrfs: zoned: allow DUP on meta-data block groups")
CC: stable@vger.kernel.org # 6.1+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zoned.c