]> git.hungrycats.org Git - linux/commit
btrfs: zoned: avoid underflow of space info bytes_zone_unusable
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Fri, 11 Sep 2026 11:41:12 +0000 (13:41 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Oct 2026 20:36:17 +0000 (21:36 +0100)
commite6168e8013195dcb4dd2d3f7a5993028c0628aa4
tree7e5ea5138c38cdcc89f724e792f72f311598594f
parentf1c9219fdd39cef3016ceb7f7a73bbe075108114
btrfs: zoned: avoid underflow of space info bytes_zone_unusable

The two functions btrfs_free_reserved_bytes() and
btrfs_reset_unused_block_groups() both manipulate
space_info->bytes_zone_unusable without using the accessor function
btrfs_space_info_update_bytes_zone_unusable() potentially risking an
underflow (in case of btrfs_reset_unused_block_groups()).

Use btrfs_space_info_update_bytes_zone_unusable() in both function, in
the case of btrfs_free_reserved_bytes() it is mostly for documenting
purposes.

Reviewed-by: Daniel Vacek <neelx@suse.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