diff options
author | Naohiro Aota <[email protected]> | 2024-06-11 17:17:30 +0900 |
---|---|---|
committer | David Sterba <[email protected]> | 2024-06-25 00:33:57 +0200 |
commit | b9fd2affe4aa99a4ca14ee87e1f38fea22ece52a (patch) | |
tree | e3cfd94b2af75f7da79b11936210a57d5d5be78c /scripts/generate_rust_analyzer.py | |
parent | d1825752e3074b5ff8d7f6016160e2b7c5c367ca (diff) |
btrfs: zoned: fix initial free space detection
When creating a new block group, it calls btrfs_add_new_free_space() to add
the entire block group range into the free space accounting.
__btrfs_add_free_space_zoned() checks if size == block_group->length to
detect the initial free space adding, and proceed that case properly.
However, if the zone_capacity == zone_size and the over-write speed is fast
enough, the entire zone can be over-written within one transaction. That
confuses __btrfs_add_free_space_zoned() to handle it as an initial free
space accounting. As a result, that block group becomes a strange state: 0
used bytes, 0 zone_unusable bytes, but alloc_offset == zone_capacity (no
allocation anymore).
The initial free space accounting can properly be checked by checking
alloc_offset too.
Fixes: 98173255bddd ("btrfs: zoned: calculate free space from zone capacity")
CC: [email protected] # 6.1+
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Naohiro Aota <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions