Skip to content

Commit 5b8d296

Browse files
morbidrsakdave
authored andcommitted
btrfs: zoned: fix incorrect ASSERT in btrfs_zoned_reserve_data_reloc_bg()
When moving a block-group to the dedicated data relocation space-info in btrfs_zoned_reserve_data_reloc_bg() it is asserted that the newly created block group for data relocation does not contain any zone_unusable bytes. But on disks with zone_capacity < zone_size, the difference between zone_size and zone_capacity is accounted as zone_unusable. Instead of asserting that the block-group does not contain any zone_unusable bytes, remove them from the block-groups total size. Reported-by: Yi Zhang <[email protected]> Link: https://lore.kernel.org/linux-block/CAHj4cs8-cS2E+-xQ-d2Bj6vMJZ+CwT_cbdWBTju4BV35LsvEYw@mail.gmail.com/ Fixes: daa0fde ("btrfs: zoned: fix data relocation block group reservation") Reviewed-by: Naohiro Aota <[email protected]> Tested-by: Yi Zhang <[email protected]> Signed-off-by: Johannes Thumshirn <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b62fd63 commit 5b8d296

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
@@ -2582,9 +2582,9 @@ void btrfs_zoned_reserve_data_reloc_bg(struct btrfs_fs_info *fs_info)
25822582
spin_lock(&space_info->lock);
25832583
space_info->total_bytes -= bg->length;
25842584
space_info->disk_total -= bg->length * factor;
2585+
space_info->disk_total -= bg->zone_unusable;
25852586
/* There is no allocation ever happened. */
25862587
ASSERT(bg->used == 0);
2587-
ASSERT(bg->zone_unusable == 0);
25882588
/* No super block in a block group on the zoned setup. */
25892589
ASSERT(bg->bytes_super == 0);
25902590
spin_unlock(&space_info->lock);

0 commit comments

Comments
 (0)