@@ -222,11 +222,11 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
disk_bytenr = (u64)bio->bi_iter.bi_sector << 9;
if (dio)
offset = logical_offset;
+ else
+ offset = page_offset(bvec->bv_page) + bvec->bv_offset;
page_bytes_left = bvec->bv_len;
while (bio_index < bio->bi_vcnt) {
- if (!dio)
- offset = page_offset(bvec->bv_page) + bvec->bv_offset;
count = btrfs_find_ordered_sum(inode, offset, disk_bytenr,
(u32 *)csum, nblocks);
if (count)
@@ -301,6 +301,9 @@ found:
goto done;
}
bvec++;
+ if (!dio)
+ offset = page_offset(bvec->bv_page)
+ + bvec->bv_offset;
page_bytes_left = bvec->bv_len;
}
In __btrfs_lookup_bio_sums() we set the file offset value at the beginning of every iteration of the while loop. This is incorrect since the blocks mapped by the current bvec->bv_page might not yet have been completely processed. This commit fixes the issue by setting the file offset value when we move to the next bvec of the bio. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> --- fs/btrfs/file-item.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)