From: David Sterba Date: Thu, 2 Jul 2020 09:10:18 +0000 (+0200) Subject: btrfs: store precalculated csum_size in fs_info X-Git-Tag: v5.15~1812^2~172 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22b6331d961712ac2735423e5a6c04e9d0fd7897;p=platform%2Fkernel%2Flinux-starfive.git btrfs: store precalculated csum_size in fs_info In many places we need the checksum size and it is inefficient to read it from the raw superblock. Store the value into fs_info, actual use will be in followup patches. The size is u32 as it allows to generate better assembly than with u16. Reviewed-by: Johannes Thumshirn Signed-off-by: David Sterba --- diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index b94b4fe..3d06596 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -937,6 +937,7 @@ struct btrfs_fs_info { u32 sectorsize; /* ilog2 of sectorsize, use to avoid 64bit division */ u32 sectorsize_bits; + u32 csum_size; u32 stripesize; /* Block groups and devices containing active swapfiles. */ diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 25889a2..475bd19 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3080,6 +3080,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device fs_info->nodesize = nodesize; fs_info->sectorsize = sectorsize; fs_info->sectorsize_bits = ilog2(sectorsize); + fs_info->csum_size = btrfs_super_csum_size(disk_super); fs_info->stripesize = stripesize; /*