@@ -2851,9 +2851,12 @@ static int btrfs_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
u64 start, u64 end, int mirror)
{
size_t offset = start - page_offset(page);
+ size_t pg_off;
struct inode *inode = page->mapping->host;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
struct btrfs_root *root = BTRFS_I(inode)->root;
+ u32 sectorsize = root->fs_info->sectorsize;
+ bool found_err = false;
if (PageChecked(page)) {
ClearPageChecked(page);
@@ -2870,7 +2873,17 @@ static int btrfs_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
}
phy_offset >>= inode->i_sb->s_blocksize_bits;
- return check_data_csum(inode, io_bio, phy_offset, page, offset);
+ for (pg_off = offset; pg_off < end - page_offset(page);
+ pg_off += sectorsize, phy_offset++) {
+ int ret;
+
+ ret = check_data_csum(inode, io_bio, phy_offset, page, pg_off);
+ if (ret < 0)
+ found_err = true;
+ }
+ if (found_err)
+ return -EIO;
+ return 0;
}
/*