From: Johannes Thumshirn Date: Fri, 10 Feb 2023 10:50:08 +0000 (-0800) Subject: btrfs: open code btrfs_csum_ptr X-Git-Tag: v6.6.17~4651^2~171 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa13661c48debbfb0a749e9328ea5648cf18fab4;p=platform%2Fkernel%2Flinux-rpi.git btrfs: open code btrfs_csum_ptr Remove btrfs_csum_ptr() and fold it into it's only caller. Reviewed-by: Anand Jain Reviewed-by: Christoph Hellwig Signed-off-by: Johannes Thumshirn Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5dbb4aa..1851e9c 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3367,13 +3367,6 @@ int btrfs_check_sector_csum(struct btrfs_fs_info *fs_info, struct page *page, return 0; } -static u8 *btrfs_csum_ptr(const struct btrfs_fs_info *fs_info, u8 *csums, u64 offset) -{ - u64 offset_in_sectors = offset >> fs_info->sectorsize_bits; - - return csums + offset_in_sectors * fs_info->csum_size; -} - /* * Verify the checksum of a single data sector. * @@ -3411,7 +3404,8 @@ bool btrfs_data_csum_ok(struct btrfs_bio *bbio, struct btrfs_device *dev, return true; } - csum_expected = btrfs_csum_ptr(fs_info, bbio->csum, bio_offset); + csum_expected = bbio->csum + (bio_offset >> fs_info->sectorsize_bits) * + fs_info->csum_size; if (btrfs_check_sector_csum(fs_info, bv->bv_page, bv->bv_offset, csum, csum_expected)) goto zeroit;