Commit 15b6e8a8 authored by David Sterba's avatar David Sterba

btrfs: reduce pointer intdirections in btree_readpage_end_io_hook

All we need to read is checksum size from fs_info superblock, and
fs_info is provided by extent buffer so we can get rid of the wild
pointer indirections from page/inode/root.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b79ce3dd
...@@ -604,9 +604,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio, ...@@ -604,9 +604,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
u64 found_start; u64 found_start;
int found_level; int found_level;
struct extent_buffer *eb; struct extent_buffer *eb;
struct btrfs_root *root = BTRFS_I(page->mapping->host)->root; struct btrfs_fs_info *fs_info;
struct btrfs_fs_info *fs_info = root->fs_info; u16 csum_size;
u16 csum_size = btrfs_super_csum_size(fs_info->super_copy);
int ret = 0; int ret = 0;
u8 result[BTRFS_CSUM_SIZE]; u8 result[BTRFS_CSUM_SIZE];
int reads_done; int reads_done;
...@@ -615,6 +614,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio, ...@@ -615,6 +614,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
goto out; goto out;
eb = (struct extent_buffer *)page->private; eb = (struct extent_buffer *)page->private;
fs_info = eb->fs_info;
csum_size = btrfs_super_csum_size(fs_info->super_copy);
/* the pending IO might have been the only thing that kept this buffer /* 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 * in memory. Make sure we have a ref for all this other checks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment