btrfs: remove assertions after btrfs_bio struct changes
PATCH 1/1 btrfs: remove assertions after btrfs_bio struct changes
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.
--- fs/btrfs/bio.c | 6 ------ 1 file changed, 6 deletions(-)
fs/btrfs/bio.c +0 -6
@@ -307,9 +307,6 @@ static void btrfs_check_read_bio(struct btrfs_bio *bbio, struct btrfs_device *dephys_addr_t paddr;u32 offset =0 ; -/* Read-repair requires the inode field to be set by the submitter. */ -ASSERT (inode); -/* * Hand off repair bios to the repair code as there is no upper level * submitter for them.
@@ -899,9 +896,6 @@ static void assert_bbio_alignment(struct btrfs_bio *bbio)void btrfs_submit_bbio (struct btrfs_bio *bbio,int mirror_num) { -/* If bbio->inode is not populated, its file_offset must be 0. */ -ASSERT (bbio->inode || bbio->file_offset ==0 ); -assert_bbio_alignment (bbio);while (!btrfs_submit_chunk (bbio, mirror_num))
Signature · 1 line
2.20.1
Quoted 8 lines · Zhen Ni
Commit
81cea6cd7041("btrfs: removebtrfs_bio::fs_infoby extracting it frombtrfs_bio::inode") modified thebtrfs_biostructure to make the inode field mandatory, making these assertions redundant:-
btrfs_check_read_bio(): inode is validated bybtrfs_bio_init()
-btrfs_submit_bbio(): condition always passes since inode is never NULLRemove 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.
Quoted 5 lines · David Sterba
Quoted 4 lines · Zhen Ni
Commit
81cea6cd7041("btrfs: removebtrfs_bio::fs_infoby extracting it frombtrfs_bio::inode") modified thebtrfs_biostructure to make the inode field mandatory, making these assertions redundant:
Quoted 8 lines
Quoted 4 lines
-
btrfs_check_read_bio(): inode is validated bybtrfs_bio_init()
-btrfs_submit_bbio(): condition always passes since inode is never NULLRemove 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
Quoted 9 lines · David Sterba
Quoted 8 lines · David Sterba
Quoted 7 lines · Zhen Ni
Commit
81cea6cd7041("btrfs: removebtrfs_bio::fs_infoby extracting it frombtrfs_bio::inode") modified thebtrfs_biostructure to make the inode field mandatory, making these assertions redundant:-
btrfs_check_read_bio(): inode is validated bybtrfs_bio_init()
-btrfs_submit_bbio(): condition always passes since inode is never NULL
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
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.