btrfs: zoned: fix mounting with conventional zones
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Mon, 5 Sep 2022 12:38:24 +0000 (05:38 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Sep 2022 13:39:10 +0000 (15:39 +0200)
commit6ca64ac2763149fb66c0b4bf12f5e0977a88e51d
tree2d35bc5c49fed7f44bf88e51198af61d5e89c4ad
parentcac5c44c48c9fb9cc31bea15ebd9ef0c6462314f
btrfs: zoned: fix mounting with conventional zones

Since commit 6a921de58992 ("btrfs: zoned: introduce
space_info->active_total_bytes"), we're only counting the bytes of a
block group on an active zone as usable for metadata writes. But on a
SMR drive, we don't have active zones and short circuit some of the
logic.

This leads to an error on mount, because we cannot reserve space for
metadata writes.

Fix this by also setting the BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE bit in the
block-group's runtime flag if the zone is a conventional zone.

Fixes: 6a921de58992 ("btrfs: zoned: introduce space_info->active_total_bytes")
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zoned.c