]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: zoned: reclaim unused zone by zone resetting
authorNaohiro Aota <naohiro.aota@wdc.com>
Thu, 14 Nov 2024 08:04:29 +0000 (17:04 +0900)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Jan 2025 13:53:14 +0000 (14:53 +0100)
commit453a73c3069a268c3c4dd00695fc2a95f7880438
tree1a51276e63990e0954f6c68ec43026ab044dbd30
parent7de9ca1f30b7002a237e3119a8a4a54f26988b92
btrfs: zoned: reclaim unused zone by zone resetting

On the zoned mode, once used and freed region is still not reusable after the
freeing. The underlying zone needs to be reset before reusing. Btrfs resets a
zone when it removes a block group, and then new block group is allocated on
the zones to reuse the zones. But, it is sometime too late to catch up with a
write side.

This commit introduces a new space-info reclaim method ZONE_RESET. That will
pick a block group from the unused list and reset its zone to reuse the
zone_unusable space. It is faster than removing the block group and re-creating
a new block group on the same zones.

For the first implementation, the ZONE_RESET is only applied to a block group
whose region is fully zone_unusable. Reclaiming partial zone_unusable block
group could be implemented later.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c
fs/btrfs/space-info.h
fs/btrfs/zoned.c
fs/btrfs/zoned.h
include/trace/events/btrfs.h