From: David Sterba <dsterba@suse.cz>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: stop printing condition result in assertion failure messages
Date: Fri, 20 Feb 2026 18:53:09 +0100 [thread overview]
Message-ID: <20260220175309.GK26902@twin.jikos.cz> (raw)
In-Reply-To: <9c3463215d864eb706860e7d9c853e34d4125408.1771515807.git.fdmanana@suse.com>
On Thu, Feb 19, 2026 at 03:45:39PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> It's useless to print the result of the condition, it's always 0 if the
> assertion is triggered, so it doesn't provide any useful information.
> Examples:
>
> assertion failed: cb->bbio.bio.bi_iter.bi_size == disk_num_bytes :: 0, in inode.c:9991
> assertion failed: folio_test_writeback(folio) :: 0, in subpage.c:476
>
> So stop printing that, it's always ":: 0" for any assertion triggered.
I've put it there because of the single value conditions like
ASSERT(flag);
In most cases the condition is compound and boolean so the result is not
useful and there are also many cases with simple pointer value so the
exact value is also not providing anything.
For any case we want to know exact values or possibly of subexpressions
too (like start + length or other calculations) we should use the
extended ASSERT syntax.
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
> fs/btrfs/messages.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/messages.h b/fs/btrfs/messages.h
> index 81f59afe4a99..17cdc14dc89d 100644
> --- a/fs/btrfs/messages.h
> +++ b/fs/btrfs/messages.h
> @@ -141,11 +141,11 @@ do { \
> verify_assert_printk_format("check the format string" args); \
> if (!likely(cond)) { \
This should probably become "if (likely(!cond))" as mentioned recently.
next prev parent reply other threads:[~2026-02-20 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 15:45 [PATCH] btrfs: stop printing condition result in assertion failure messages fdmanana
2026-02-19 21:52 ` Qu Wenruo
2026-02-20 17:53 ` David Sterba [this message]
2026-02-20 17:59 ` Filipe Manana
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=20260220175309.GK26902@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/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