From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: dump extra info if one free space cache has more bitmaps than it should
Date: Mon, 1 Aug 2022 10:28:12 +0800 [thread overview]
Message-ID: <34ead078-6d60-883b-19e4-4b8a7567927e@oracle.com> (raw)
In-Reply-To: <8148a70ba12d1a0da36f0834fc2a92d4742820b7.1659317748.git.wqu@suse.com>
On 01/08/2022 09:35, Qu Wenruo wrote:
> There is an internal report on hitting the following ASSERT() in
> recalculate_thresholds():
>
> ASSERT(ctl->total_bitmaps <= max_bitmaps);
>
> Above @max_bitmaps is calculated using the following variables:
>
> - bytes_per_bg
> 8 * 4096 * 4096 (128M) for x86_64/x86.
>
> - block_group->length
> The length of the block group.
>
> @max_bitmaps is the rounded up value of block_group->length / 128M.
>
> Normally one free space cache should not have more bitmaps than above
> value, but when it happens the ASSERT() can be triggered if
> CONFIG_BTRFS_ASSERT is also enabled.
>
> But the ASSERT() itself won't provide enough info to know which is going
> wrong.
> Is the bg too small thus it only allows one bitmap?
> Or is there something else wrong?
>
> So although I haven't found extra reports or crash dump to do further
> investigation, add the extra info to make it more helpful to debug.
>
I guess there is no reproducer. If there is any other related may be
added such as configs etc.
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
> ---
> fs/btrfs/free-space-cache.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index 996da650ecdc..4ebfd9b7bc53 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -693,6 +693,12 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl)
>
> max_bitmaps = max_t(u64, max_bitmaps, 1);
>
> + if (ctl->total_bitmaps > max_bitmaps)
> + btrfs_err(block_group->fs_info,
> + "invalid free space control: bg start=%llu len=%llu total_bitmaps=%u unit=%u max_bitmaps=%llu bytes_per_bg=%llu",
> + block_group->start, block_group->length,
> + ctl->total_bitmaps, ctl->unit, max_bitmaps,
> + bytes_per_bg);
> ASSERT(ctl->total_bitmaps <= max_bitmaps);
>
> /*
next prev parent reply other threads:[~2022-08-01 2:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 1:35 [PATCH] btrfs: dump extra info if one free space cache has more bitmaps than it should Qu Wenruo
2022-08-01 2:28 ` Anand Jain [this message]
2022-08-02 17:14 ` David Sterba
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=34ead078-6d60-883b-19e4-4b8a7567927e@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).