Skip to content

Commit c1d6abd

Browse files
osandovkdave
authored andcommitted
btrfs: fix check_data_csum() error message for direct I/O
Commit 1dae796aabf6 ("btrfs: inode: sink parameter start and len to check_data_csum()") replaced the start parameter to check_data_csum() with page_offset(), but page_offset() is not meaningful for direct I/O pages. Bring back the start parameter. Fixes: 265d4ac ("btrfs: sink parameter start and len to check_data_csum") CC: [email protected] # 5.11+ Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Omar Sandoval <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 0bb7883 commit c1d6abd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

fs/btrfs/inode.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,11 +3099,13 @@ void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start,
30993099
* @bio_offset: offset to the beginning of the bio (in bytes)
31003100
* @page: page where is the data to be verified
31013101
* @pgoff: offset inside the page
3102+
* @start: logical offset in the file
31023103
*
31033104
* The length of such check is always one sector size.
31043105
*/
31053106
static int check_data_csum(struct inode *inode, struct btrfs_io_bio *io_bio,
3106-
u32 bio_offset, struct page *page, u32 pgoff)
3107+
u32 bio_offset, struct page *page, u32 pgoff,
3108+
u64 start)
31073109
{
31083110
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
31093111
SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
@@ -3130,8 +3132,8 @@ static int check_data_csum(struct inode *inode, struct btrfs_io_bio *io_bio,
31303132
kunmap_atomic(kaddr);
31313133
return 0;
31323134
zeroit:
3133-
btrfs_print_data_csum_error(BTRFS_I(inode), page_offset(page) + pgoff,
3134-
csum, csum_expected, io_bio->mirror_num);
3135+
btrfs_print_data_csum_error(BTRFS_I(inode), start, csum, csum_expected,
3136+
io_bio->mirror_num);
31353137
if (io_bio->device)
31363138
btrfs_dev_stat_inc_and_print(io_bio->device,
31373139
BTRFS_DEV_STAT_CORRUPTION_ERRS);
@@ -3184,7 +3186,8 @@ int btrfs_verify_data_csum(struct btrfs_io_bio *io_bio, u32 bio_offset,
31843186
pg_off += sectorsize, bio_offset += sectorsize) {
31853187
int ret;
31863188

3187-
ret = check_data_csum(inode, io_bio, bio_offset, page, pg_off);
3189+
ret = check_data_csum(inode, io_bio, bio_offset, page, pg_off,
3190+
page_offset(page) + pg_off);
31883191
if (ret < 0)
31893192
return -EIO;
31903193
}
@@ -7907,7 +7910,8 @@ static blk_status_t btrfs_check_read_dio_bio(struct inode *inode,
79077910
ASSERT(pgoff < PAGE_SIZE);
79087911
if (uptodate &&
79097912
(!csum || !check_data_csum(inode, io_bio,
7910-
bio_offset, bvec.bv_page, pgoff))) {
7913+
bio_offset, bvec.bv_page,
7914+
pgoff, start))) {
79117915
clean_io_failure(fs_info, failure_tree, io_tree,
79127916
start, bvec.bv_page,
79137917
btrfs_ino(BTRFS_I(inode)),

0 commit comments

Comments
 (0)