btrfs: remove redundant inode NULL check in is_data_bbio()
PATCH 1/1 btrfs: remove redundant inode NULL check in is_data_bbio()
After commit 81cea6cd7041 ("btrfs: remove btrfs_bio::fs_info by extracting it from btrfs_bio::inode"), the btrfs_bio::inode field is mandatory for all btrfs_bio allocations. The NULL check is redundant and can be removed.
--- fs/btrfs/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/bio.c +1 -1
@@ -29,7 +29,7 @@ struct btrfs_failed_bio {/* Is this a data path I/O that needs storage layer checksum and repair? */ static inline bool is_data_bbio (const struct btrfs_bio *bbio) { -return bbio->inode &&is_data_inode (bbio->inode); +return is_data_inode (bbio->inode); }static bool bbio_has_ordered_extent (const struct btrfs_bio *bbio)
Signature · 1 line
2.20.1
Quoted 23 lines · Zhen Ni
After commit
81cea6cd7041("btrfs: removebtrfs_bio::fs_infoby extracting it frombtrfs_bio::inode"), thebtrfs_bio::inodefield is mandatory for allbtrfs_bioallocations. The NULL check is redundant and can be removed.Signed-off-by Zhen Ni <[email protected]>--- fs/btrfs/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/bio.c +1
-1@@ -29,7 +29,7 @@ struct btrfs_failed_bio {/* Is this a data path I/O that needs storage layer checksum and repair? */ static inline bool is_datais_data_bbio_bbio (const struct btrfs_bio *bbio) { -return bbio->inode &&is_data_inode (bbio->inode); +return is_data_inode (bbio->inode); }
Quoted 1 line
static bool
bbio_has_ordered_extent(const struct btrfs_bio *bbio)
But then is_data_bbio() becomes a simple wrapper around is_data_inode() not adding any functionality or documentation. I'd think you scan just replace is_data_bbio(bbio) with is_data_inode(bbio->inode) in all of bio.c
Quoted 15 lines · Zhen Ni
After commit
81cea6cd7041("btrfs: removebtrfs_bio::fs_infoby extracting it frombtrfs_bio::inode"), thebtrfs_bio::inodefield is mandatory for allbtrfs_bioallocations. The NULL check is redundant and can be removed.Signed-off-by Zhen Ni <[email protected]>--- fs/btrfs/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/bio.c +0
-0
fs/btrfs/bio.c struct btrfs_failed_bio { · line 32
Quoted 5 lines
fs/btrfs/bio.c +1
-1@@ -29,7 +29,7 @@ struct btrfs_failed_bio {/* Is this a data path I/O that needs storage layer checksum and repair? */ static inline bool is_data_bbio (const struct btrfs_bio *bbio) { -return bbio->inode &&is_data_inode (bbio->inode); +return is_data_inode (bbio->inode);
Removing the 'bbio->inode' check would be good and as Johannes pointed out then is_data_bbio() can be replaced by is_data_inode().
If you're still interested, please send an updated patch with that change. Thanks.