Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove redundant inode NULL check in is_data_bbio()
@ 2025-12-19  8:43 Zhen Ni
  2025-12-19 12:56 ` Johannes Thumshirn
  0 siblings, 1 reply; 2+ messages in thread
From: Zhen Ni @ 2025-12-19  8:43 UTC (permalink / raw)
  To: clm, dsterba; +Cc: linux-btrfs, Zhen Ni

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.

Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
 fs/btrfs/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index fa1d321a2fb8..ce649e265b75 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -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)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: remove redundant inode NULL check in is_data_bbio()
  2025-12-19  8:43 [PATCH] btrfs: remove redundant inode NULL check in is_data_bbio() Zhen Ni
@ 2025-12-19 12:56 ` Johannes Thumshirn
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Thumshirn @ 2025-12-19 12:56 UTC (permalink / raw)
  To: Zhen Ni, clm@fb.com, dsterba@suse.com; +Cc: linux-btrfs@vger.kernel.org

On 12/19/25 9:43 AM, Zhen Ni wrote:
> 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.
>
> Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
> ---
>   fs/btrfs/bio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
> index fa1d321a2fb8..ce649e265b75 100644
> --- a/fs/btrfs/bio.c
> +++ b/fs/btrfs/bio.c
> @@ -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);
>   }
>   
>   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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-19 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19  8:43 [PATCH] btrfs: remove redundant inode NULL check in is_data_bbio() Zhen Ni
2025-12-19 12:56 ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox