]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: use greedy gc for auto reclaim
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Thu, 14 Oct 2021 09:39:02 +0000 (18:39 +0900)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Oct 2021 17:08:07 +0000 (19:08 +0200)
commit4ea89a4374c6498834751eda4143eaf1b75cf6a6
treee4623302dab0267b646a145fd4ace9c39d808d41
parentb86dbedc1ae36027088f9db934fc768954f3bc3b
btrfs: zoned: use greedy gc for auto reclaim

Currently auto reclaim of unusable zones reclaims the block-groups in
the order they have been added to the reclaim list.

Change this to a greedy algorithm by sorting the list so we have the
block-groups with the least amount of valid bytes reclaimed first.

Note: we can't splice the block groups from reclaim_bgs to let the sort
happen outside of the lock. The block groups can be still in use by
other parts eg. via bg_list and we must hold unused_bgs_lock while
processing them.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ write note and comment why we can't splice the list ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c