public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: simplify check for zoned NODATASUM writes in btrfs_submit_chunk()
@ 2025-12-19  7:36 Zhen Ni
  2025-12-19 12:57 ` Johannes Thumshirn
  2025-12-20  0:09 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Zhen Ni @ 2025-12-19  7:36 UTC (permalink / raw)
  To: clm, dsterba; +Cc: linux-btrfs, Zhen Ni

This function already dereferences 'inode' multiple times earlier,
making the additional NULL check at line 840 redundant since the
function would have crashed already if inode were NULL.

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 and is guaranteed to be
non-NULL.

Simplify the condition for allocating dummy checksums for zoned
NODATASUM data by removing the unnecessary 'inode &&' check.

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..abe3e5e7c5d9 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -837,7 +837,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
 			if (status)
 				goto fail;
 		} else if (use_append ||
-			   (btrfs_is_zoned(fs_info) && inode &&
+			   (btrfs_is_zoned(fs_info) &&
 			    inode->flags & BTRFS_INODE_NODATASUM)) {
 			ret = btrfs_alloc_dummy_sum(bbio);
 			status = errno_to_blk_status(ret);
-- 
2.20.1


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

end of thread, other threads:[~2025-12-20  0:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19  7:36 [PATCH] btrfs: simplify check for zoned NODATASUM writes in btrfs_submit_chunk() Zhen Ni
2025-12-19 12:57 ` Johannes Thumshirn
2025-12-20  0:09 ` David Sterba

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