From: "zhen.ni" <zhen.ni@easystack.cn>
To: dsterba@suse.cz
Cc: clm@fb.com, dsterba@suse.com, wqu@suse.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: remove assertions after btrfs_bio struct changes
Date: Fri, 19 Dec 2025 10:50:18 +0800 [thread overview]
Message-ID: <2b992fc4-cb47-4733-bee4-c670ed6a3401@easystack.cn> (raw)
In-Reply-To: <20251218140536.GP3195@suse.cz>
在 2025/12/18 22:05, David Sterba 写道:
> On Thu, Dec 18, 2025 at 02:57:25PM +0100, David Sterba wrote:
>> On Thu, Dec 18, 2025 at 08:22:15PM +0800, Zhen Ni wrote:
>>> Commit 81cea6cd7041 ("btrfs: remove btrfs_bio::fs_info by extracting it
>>> from btrfs_bio::inode") modified the btrfs_bio structure to make the
>>> inode field mandatory, making these assertions redundant:
>>>
>>> - btrfs_check_read_bio(): inode is validated by btrfs_bio_init()
>>> - btrfs_submit_bbio(): condition always passes since inode is never NULL
>>>
>>> Remove these obsolete checks.
>>
>> The assertions may be redundant and their purpose is to catch accidental
>> changes to code or explicitly list some critical assumptions. We'd like
>> to have more rather than fewer of them.
>
> https://btrfs.readthedocs.io/en/latest/dev/Development-notes.html#handling-unexpected-conditions
>
>
Thank you for pointing out the relevant documentation.
Maintaining these assertions (or even adding more) is the better
approach. They not only prevent current errors but, more importantly,
prevent future code modifications from introducing problems.
prev parent reply other threads:[~2025-12-19 2:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 12:22 [PATCH] btrfs: remove assertions after btrfs_bio struct changes Zhen Ni
2025-12-18 13:57 ` David Sterba
2025-12-18 14:05 ` David Sterba
2025-12-19 2:50 ` zhen.ni [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=2b992fc4-cb47-4733-bee4-c670ed6a3401@easystack.cn \
--to=zhen.ni@easystack.cn \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--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