Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: simplify check for zoned NODATASUM writes in btrfs_submit_chunk()

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.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Zhen Ni and committed by
David Sterba
fdb945f6 8d206b0c

+1 -2
+1 -2
fs/btrfs/bio.c
··· 836 836 if (status) 837 837 goto fail; 838 838 } else if (bbio->can_use_append || 839 - (btrfs_is_zoned(fs_info) && inode && 840 - inode->flags & BTRFS_INODE_NODATASUM)) { 839 + (btrfs_is_zoned(fs_info) && inode->flags & BTRFS_INODE_NODATASUM)) { 841 840 ret = btrfs_alloc_dummy_sum(bbio); 842 841 status = errno_to_blk_status(ret); 843 842 if (status)