From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: Miroslav Cimerman <mc@raidlab.org>, linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>, Chris Mason <mason@kernel.org>,
Naohiro Aota <naohiro.aota@wdc.com>, Qu Wenruo <wqu@suse.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] btrfs: zoned: finish raid stripe tree zones once all data is written
Date: Mon, 30 Nov 2026 15:31:38 +0100 [thread overview]
Message-ID: <3921c558-19eb-4357-93ca-6036d1e003da@wdc.com> (raw)
In-Reply-To: <20261129235226.459661-4-mc@raidlab.org>
On 30.11.26 00:52, Miroslav Cimerman wrote:
> diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
> index 0736132624f8..ce3f7b98f00d 100644
> --- a/fs/btrfs/block-group.c
> +++ b/fs/btrfs/block-group.c
> @@ -419,13 +419,19 @@ void btrfs_wait_block_group_reservations(struct btrfs_block_group *bg)
> {
> struct btrfs_space_info *space_info = bg->space_info;
>
> - ASSERT(bg->ro);
> + /*
> + * A zoned block group with less than a sector left takes no new
> + * allocations either.
> + */
> + ASSERT(bg->ro || (btrfs_is_zoned(bg->fs_info) &&
> + bg->alloc_offset + bg->fs_info->sectorsize >
> + bg->zone_capacity));
>
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...);
[...]
> @@ -3732,8 +3738,12 @@ void btrfs_free_reserved_bytes(struct btrfs_block_group *cache, u64 num_bytes,
> bg_ro = cache->ro;
> cache->reserved -= num_bytes;
> btrfs_maybe_reset_size_class(cache);
> - if (is_delalloc)
> + if (is_delalloc) {
> cache->delalloc_bytes -= num_bytes;
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.
> + /* See btrfs_zone_finish_rst_workfn(). */
> + if (!cache->delalloc_bytes)
> + wake_up_var_locked(&cache->delalloc_bytes, &cache->lock);
> + }
next prev parent reply other threads:[~2026-11-30 14:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 23:52 [PATCH v2 0/3] btrfs: zoned: unwritten copies of mirrored data writes Miroslav Cimerman
2026-11-29 23:52 ` [PATCH v2 1/3] btrfs: zoned: use zone append for every copy of a mirrored write Miroslav Cimerman
2026-11-29 23:52 ` [PATCH v2 2/3] btrfs: zoned: wait for zone finish works at unmount Miroslav Cimerman
2026-11-30 10:27 ` Johannes Thumshirn
2026-11-30 11:07 ` Miroslav Cimerman
2026-11-30 14:04 ` Johannes Thumshirn
2026-11-29 23:52 ` [PATCH v2 3/3] btrfs: zoned: finish raid stripe tree zones once all data is written Miroslav Cimerman
2026-11-30 14:31 ` Johannes Thumshirn [this message]
2026-11-30 16:55 ` Miroslav Cimerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3921c558-19eb-4357-93ca-6036d1e003da@wdc.com \
--to=johannes.thumshirn@wdc.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--cc=mc@raidlab.org \
--cc=naohiro.aota@wdc.com \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®