Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a8b70c7

Browse files
morbidrsakdave
authored andcommitted
btrfs: zoned: don't skip block groups with 100% zone unusable
Commit f4a9f21 ("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: f4a9f21 ("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>
1 parent 2133460 commit a8b70c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/block-group.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,8 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
15591559
* needing to allocate extents from the block group.
15601560
*/
15611561
used = btrfs_space_info_used(space_info, true);
1562-
if (space_info->total_bytes - block_group->length < used) {
1562+
if (space_info->total_bytes - block_group->length < used &&
1563+
block_group->zone_unusable < block_group->length) {
15631564
/*
15641565
* Add a reference for the list, compensate for the ref
15651566
* drop under the "next" label for the

0 commit comments

Comments
 (0)