mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
btrfs: zoned: fix block group alloc_offset calculation
commit0ae79c6fe7upstream. alloc_offset is offset from the start of a block group and @offset is actually an address in logical space. Thus, we need to consider block_group->start when calculating them. Fixes:011b41bffa("btrfs: zoned: advance allocation pointer after tree log node") CC: stable@vger.kernel.org # 5.12+ Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
802a090d51
commit
2a9f99a287
@@ -2652,8 +2652,11 @@ int btrfs_remove_free_space(struct btrfs_block_group *block_group,
|
||||
* btrfs_pin_extent_for_log_replay() when replaying the log.
|
||||
* Advance the pointer not to overwrite the tree-log nodes.
|
||||
*/
|
||||
if (block_group->alloc_offset < offset + bytes)
|
||||
block_group->alloc_offset = offset + bytes;
|
||||
if (block_group->start + block_group->alloc_offset <
|
||||
offset + bytes) {
|
||||
block_group->alloc_offset =
|
||||
offset + bytes - block_group->start;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user