Re: [PATCH v2 3/3] btrfs: zoned: finish raid stripe tree zones once all data is written
From: Miroslav Cimerman
Date: Mon Nov 30 2026 - 11:55:54 EST
Hi Johannes,
Johannes Thumshirn <johannes.thumshirn@xxxxxxx> wrote:
> Please make that multiple ASSERT()s, so we can debug which one fired.
> The new verbose ASSERT() is awesome for it:
>
> ASSERT(bg->ro);
> ASSERT(btrfs_is_zoned() && bg->alloc_offset + bg->fs_info->sectorsize +
> bg->zone_capacity, "bg->alloc_offset=%u, bg->fs_info->sectorsize=%u,
> bg->zone_capacity", bg->alloc_offset...);
Okay, I will split the asserts and add the messages to them in v3.
> Can this ever underflow? This is in the pre-existing code as well, but
> now you explicitly check if it is 0, so if we underflow it, the
> wake_up_var() will not trigger causing a hang.
No. Each delalloc reservation is subtracted exactly once, with the same
length: by btrfs_release_delalloc_bytes() when its ordered extent
finishes, or by btrfs_free_reserved_extent(..., true) when it is freed
instead. I will add an ASSERT() before both decrements in v3.
Miroslav