Skip to content

Commit aa9ffad

Browse files
naotakdave
authored andcommitted
btrfs: zoned: fix comparison of alloc_offset vs meta_write_pointer
The block_group->alloc_offset is an offset from the start of the block group. OTOH, the ->meta_write_pointer is an address in the logical space. So, we should compare the alloc_offset shifted with the block_group->start. Fixes: afba2bc ("btrfs: zoned: implement active zone tracking") CC: [email protected] # 5.16+ Signed-off-by: Naohiro Aota <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 152555b commit aa9ffad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/zoned.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
18901890
/* Check if we have unwritten allocated space */
18911891
if ((block_group->flags &
18921892
(BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)) &&
1893-
block_group->alloc_offset > block_group->meta_write_pointer) {
1893+
block_group->start + block_group->alloc_offset > block_group->meta_write_pointer) {
18941894
spin_unlock(&block_group->lock);
18951895
return -EAGAIN;
18961896
}

0 commit comments

Comments
 (0)