public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Adarsh Das <adarshdas950@gmail.com>, clm@fb.com, dsterba@suse.com
Cc: terrelln@fb.com, linux-btrfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/4] btrfs: replace BUG() and BUG_ON() with error handling
Date: Sat, 28 Feb 2026 07:31:57 +1030	[thread overview]
Message-ID: <5cd8bfb3-8631-441e-a84a-70de675d2cfd@gmx.com> (raw)
In-Reply-To: <20260227183111.9311-1-adarshdas950@gmail.com>



在 2026/2/28 05:01, Adarsh Das 写道:
> Replace BUG() and BUG_ON() calls in compression.c and extent-tree.c
> with proper error handling so the kernel does not crash on unexpected
> conditions.

I think one needs to distinguish sanity checks and real proper error 
handling.

I'd say, if some parameter/values are only generated from runtime code, 
you're doing sanity checks, and it applies to most of your fixes.

In that case, ASSERT() is preferred, and should be checked as early as 
possible (e.g. checks before adding something to a list/rbtree, other 
than checking when handling the list/rbtree entry).

And if some developer hits that ASSERT() frequently enough, we can later 
change it to a proper error handling later.



If something is read from the disk, it needs proper error handling, but 
in that case it should be done in tree-checker, which provides a more 
concentrated place to do such checks.

In the original location where there is a BUG_ON(), after making sure 
it's already covered by tree-checker (or adding the missing check), 
replacing the BUG_ON() with an ASSERT().


> Also fix checkpatch warnings and errors found in both files.

For such code style errors, fix them inside the real helpful patches 
instead.

Thanks,
Qu

> 
> Adarsh Das (4):
>    btrfs: replace BUG() with error handling in compression.c
>    btrfs: clean coding style errors and warnings in compression.c
>    btrfs: replace BUG() and BUG_ON() with error handling in extent-tree.c
>    btrfs: clean coding style errors in extent-tree.c
> 
>   fs/btrfs/compression.c | 66 ++++++++++++-------------------
>   fs/btrfs/extent-tree.c | 89 +++++++++++++++++++++++++++++++-----------
>   2 files changed, 91 insertions(+), 64 deletions(-)
> 


      parent reply	other threads:[~2026-02-27 21:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 18:31 [PATCH 0/4] btrfs: replace BUG() and BUG_ON() with error handling Adarsh Das
2026-02-27 18:31 ` [PATCH 1/4] btrfs: replace BUG() with error handling in compression.c Adarsh Das
2026-02-27 20:22   ` Qu Wenruo
2026-02-27 18:31 ` [PATCH 2/4] btrfs: clean coding style errors and warnings " Adarsh Das
2026-02-27 20:43   ` Qu Wenruo
2026-02-27 18:31 ` [PATCH 3/4] btrfs: replace BUG() and BUG_ON() with error handling in extent-tree.c Adarsh Das
2026-02-27 20:43   ` Qu Wenruo
2026-02-27 18:31 ` [PATCH 4/4] btrfs: clean coding style errors " Adarsh Das
2026-02-27 20:44   ` Qu Wenruo
2026-02-27 21:01 ` Qu Wenruo [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=5cd8bfb3-8631-441e-a84a-70de675d2cfd@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=adarshdas950@gmail.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=terrelln@fb.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