mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
btrfs: zoned: don't skip block groups with 100% zone unusable
commita8b70c7f86
upstream. Commitf4a9f21941
("btrfs: do not delete unused block group if it may be used soon") changed the behaviour of deleting unused block-groups on zoned filesystems. Starting with this commit, we're using btrfs_space_info_used() to calculate the number of used bytes in a space_info. But btrfs_space_info_used() also accounts btrfs_space_info::bytes_zone_unusable as used bytes. So if a block group is 100% zone_unusable it is skipped from the deletion step. In order not to skip fully zone_unusable block-groups, also check if the block-group has bytes left that can be used on a zoned filesystem. Fixes:f4a9f21941
("btrfs: do not delete unused block group if it may be used soon") CC: stable@vger.kernel.org # 6.1+ Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6b226ae43d
commit
a321a9907c
1 changed files with 2 additions and 1 deletions
|
@ -1413,7 +1413,8 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
|
|||
* needing to allocate extents from the block group.
|
||||
*/
|
||||
used = btrfs_space_info_used(space_info, true);
|
||||
if (space_info->total_bytes - block_group->length < used) {
|
||||
if (space_info->total_bytes - block_group->length < used &&
|
||||
block_group->zone_unusable < block_group->length) {
|
||||
/*
|
||||
* Add a reference for the list, compensate for the ref
|
||||
* drop under the "next" label for the
|
||||
|
|
Loading…
Reference in a new issue