btrfs: zoned: make auto-reclaim less aggressive
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Tue, 29 Mar 2022 08:56:09 +0000 (01:56 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 May 2022 15:03:11 +0000 (17:03 +0200)
commit3687fcb0752ac9c4630b4aeb5362c6e6f81c528e
treee6b2116374c6bd3f4ac7ed096daf179ef297a374
parentef972e7b5edeec9ed5213476186ceae5798b01e8
btrfs: zoned: make auto-reclaim less aggressive

The current auto-reclaim algorithm starts reclaiming all block groups
with a zone_unusable value above a configured threshold. This is causing
a lot of reclaim IO even if there would be enough free zones on the
device.

Instead of only accounting a block groups zone_unusable value, also take
the ratio of free and not usable (written as well as zone_unusable)
bytes a device has into account.

Tested-by: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c
fs/btrfs/zoned.c
fs/btrfs/zoned.h