]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: activate block group properly on unlimited active zone device
authorNaohiro Aota <naohiro.aota@wdc.com>
Tue, 3 May 2022 21:10:05 +0000 (14:10 -0700)
committerDavid Sterba <dsterba@suse.com>
Thu, 5 May 2022 19:05:56 +0000 (21:05 +0200)
commit76d9ab9f76168e62cb798ac0db687f1ffbdb3b3e
tree720f55b0ea77738de91ea022638fcc792ef5062e
parentb1adb82dedee7e545700d191c52dc753d36fe0bf
btrfs: zoned: activate block group properly on unlimited active zone device

btrfs_zone_activate() checks if it activated all the underlying zones in
the loop. However, that check never hit on an unlimited activate zone
device (max_active_zones == 0).

Fortunately, it still works without ENOSPC because btrfs_zone_activate()
returns true in the end, even if block_group->zone_is_active == 0. But, it
is confusing to have non zone_is_active block group still usable for
allocation. Also, we are wasting CPU time to iterate the loop every time
btrfs_zone_activate() is called for the blog groups.

Since error case in the loop is handled by out_unlock, we can just set
zone_is_active and do the list stuff after the loop.

Fixes: 87e2c6e56182 ("btrfs: zoned: make zone activation multi stripe capable")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zoned.c