@@ -3440,20 +3440,18 @@ int btrfs_check_sector_csum(struct btrfs_fs_info *fs_info, struct page *page,
34403440/*
34413441 * check_data_csum - verify checksum of one sector of uncompressed data
34423442 * @inode: inode
3443- * @io_bio: btrfs_io_bio which contains the csum
3443+ * @bbio: btrfs_bio which contains the csum
34443444 * @bio_offset: offset to the beginning of the bio (in bytes)
34453445 * @page: page where is the data to be verified
34463446 * @pgoff: offset inside the page
3447- * @start: logical offset in the file
34483447 *
34493448 * The length of such check is always one sector size.
34503449 *
34513450 * When csum mismatch is detected, we will also report the error and fill the
34523451 * corrupted range with zero. (Thus it needs the extra parameters)
34533452 */
3454- static int check_data_csum (struct inode * inode , struct btrfs_bio * bbio ,
3455- u32 bio_offset , struct page * page , u32 pgoff ,
3456- u64 start )
3453+ int btrfs_check_data_csum (struct inode * inode , struct btrfs_bio * bbio ,
3454+ u32 bio_offset , struct page * page , u32 pgoff )
34573455{
34583456 struct btrfs_fs_info * fs_info = btrfs_sb (inode -> i_sb );
34593457 u32 len = fs_info -> sectorsize ;
@@ -3469,8 +3467,9 @@ static int check_data_csum(struct inode *inode, struct btrfs_bio *bbio,
34693467 return 0 ;
34703468
34713469zeroit :
3472- btrfs_print_data_csum_error (BTRFS_I (inode ), start , csum , csum_expected ,
3473- bbio -> mirror_num );
3470+ btrfs_print_data_csum_error (BTRFS_I (inode ),
3471+ bbio -> file_offset + bio_offset ,
3472+ csum , csum_expected , bbio -> mirror_num );
34743473 if (bbio -> device )
34753474 btrfs_dev_stat_inc_and_print (bbio -> device ,
34763475 BTRFS_DEV_STAT_CORRUPTION_ERRS );
@@ -3539,8 +3538,7 @@ unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio,
35393538 EXTENT_NODATASUM );
35403539 continue ;
35413540 }
3542- ret = check_data_csum (inode , bbio , bio_offset , page , pg_off ,
3543- page_offset (page ) + pg_off );
3541+ ret = btrfs_check_data_csum (inode , bbio , bio_offset , page , pg_off );
35443542 if (ret < 0 ) {
35453543 const int nr_bit = (pg_off - offset_in_page (start )) >>
35463544 root -> fs_info -> sectorsize_bits ;
@@ -8004,8 +8002,8 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,
80048002 u64 start = bbio -> file_offset + offset ;
80058003
80068004 if (uptodate &&
8007- (!csum || !check_data_csum (inode , bbio , offset , bv .bv_page ,
8008- bv .bv_offset , start ))) {
8005+ (!csum || !btrfs_check_data_csum (inode , bbio , offset , bv .bv_page ,
8006+ bv .bv_offset ))) {
80098007 clean_io_failure (fs_info , failure_tree , io_tree , start ,
80108008 bv .bv_page , btrfs_ino (BTRFS_I (inode )),
80118009 bv .bv_offset );
@@ -10387,7 +10385,6 @@ static blk_status_t btrfs_encoded_read_verify_csum(struct btrfs_bio *bbio)
1038710385 u32 sectorsize = fs_info -> sectorsize ;
1038810386 struct bio_vec * bvec ;
1038910387 struct bvec_iter_all iter_all ;
10390- u64 start = priv -> file_offset ;
1039110388 u32 bio_offset = 0 ;
1039210389
1039310390 if (priv -> skip_csum || !uptodate )
@@ -10400,10 +10397,9 @@ static blk_status_t btrfs_encoded_read_verify_csum(struct btrfs_bio *bbio)
1040010397 pgoff = bvec -> bv_offset ;
1040110398 for (i = 0 ; i < nr_sectors ; i ++ ) {
1040210399 ASSERT (pgoff < PAGE_SIZE );
10403- if (check_data_csum (& inode -> vfs_inode , bbio , bio_offset ,
10404- bvec -> bv_page , pgoff , start ))
10400+ if (btrfs_check_data_csum (& inode -> vfs_inode , bbio , bio_offset ,
10401+ bvec -> bv_page , pgoff ))
1040510402 return BLK_STS_IOERR ;
10406- start += sectorsize ;
1040710403 bio_offset += sectorsize ;
1040810404 pgoff += sectorsize ;
1040910405 }
0 commit comments