public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@kernel.org>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: stop printing condition result in assertion failure messages
Date: Fri, 20 Feb 2026 17:59:38 +0000	[thread overview]
Message-ID: <CAL3q7H7aeu5n+A2L9KMc3mt+MpQr6THZ3t7+-S-jX+PwZKKPLw@mail.gmail.com> (raw)
In-Reply-To: <20260220175309.GK26902@twin.jikos.cz>

On Fri, Feb 20, 2026 at 5:53 PM David Sterba <dsterba@suse.cz> wrote:
>
> 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.

I think you mean:

if (unlikely(!cond))

I can add that in a separate patch.

      reply	other threads:[~2026-02-20 18:00 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
2026-02-20 17:59   ` Filipe Manana [this message]

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=CAL3q7H7aeu5n+A2L9KMc3mt+MpQr6THZ3t7+-S-jX+PwZKKPLw@mail.gmail.com \
    --to=fdmanana@kernel.org \
    --cc=dsterba@suse.cz \
    --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