summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2020-06-30 02:01:31 +0200
committerDavid Sterba <dsterba@suse.com>2020-12-08 15:53:59 +0100
commit55fc29bed8ddb4c3848ecf8cf7133e34c946f223 (patch)
treec7174086f876963be22ca15e63e05560378d4518 /fs/btrfs/disk-io.c
parentbtrfs: precalculate checksums per leaf once (diff)
downloadlinux-55fc29bed8ddb4c3848ecf8cf7133e34c946f223.tar.xz
linux-55fc29bed8ddb4c3848ecf8cf7133e34c946f223.zip
btrfs: use cached value of fs_info::csum_size everywhere
btrfs_get_16 shows up in the system performance profiles (helper to read 16bit values from on-disk structures). This is partially because of the checksum size that's frequently read along with data reads/writes, other u16 uses are from item size or directory entries. Replace all calls to btrfs_super_csum_size by the cached value from fs_info. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 0e540ddd7d99..95ebe7c84dd7 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -321,7 +321,7 @@ static int btrfs_check_super_csum(struct btrfs_fs_info *fs_info,
crypto_shash_digest(shash, raw_disk_sb + BTRFS_CSUM_SIZE,
BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE, result);
- if (memcmp(disk_sb->csum, result, btrfs_super_csum_size(disk_sb)))
+ if (memcmp(disk_sb->csum, result, fs_info->csum_size))
return 1;
return 0;
@@ -454,7 +454,7 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page)
u64 start = page_offset(page);
u64 found_start;
u8 result[BTRFS_CSUM_SIZE];
- u16 csum_size = btrfs_super_csum_size(fs_info->super_copy);
+ const u16 csum_size = fs_info->csum_size;
struct extent_buffer *eb;
int ret;
@@ -543,7 +543,7 @@ int btrfs_validate_metadata_buffer(struct btrfs_io_bio *io_bio, u64 phy_offset,
eb = (struct extent_buffer *)page->private;
fs_info = eb->fs_info;
- csum_size = btrfs_super_csum_size(fs_info->super_copy);
+ csum_size = fs_info->csum_size;
/* the pending IO might have been the only thing that kept this buffer
* in memory. Make sure we have a ref for all this other checks