提交 ac303b69 编写于 作者: Q Qu Wenruo 提交者: David Sterba

btrfs: pass bvec to csum_dirty_buffer instead of page

Currently csum_dirty_buffer() uses page to grab extent buffer, but that
only works for sector size == PAGE_SIZE case.

For subpage we need page + page_offset to grab extent buffer.
Reviewed-by: NNikolay Borisov <nborisov@suse.com>
Signed-off-by: NQu Wenruo <wqu@suse.com>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 77bf40a2
...@@ -444,12 +444,13 @@ static int btree_read_extent_buffer_pages(struct extent_buffer *eb, ...@@ -444,12 +444,13 @@ static int btree_read_extent_buffer_pages(struct extent_buffer *eb,
} }
/* /*
* checksum a dirty tree block before IO. This has extra checks to make sure * Checksum a dirty tree block before IO. This has extra checks to make sure
* we only fill in the checksum field in the first page of a multi-page block * we only fill in the checksum field in the first page of a multi-page block.
* For subpage extent buffers we need bvec to also read the offset in the page.
*/ */
static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct bio_vec *bvec)
static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page)
{ {
struct page *page = bvec->bv_page;
u64 start = page_offset(page); u64 start = page_offset(page);
u64 found_start; u64 found_start;
u8 result[BTRFS_CSUM_SIZE]; u8 result[BTRFS_CSUM_SIZE];
...@@ -791,7 +792,7 @@ static blk_status_t btree_csum_one_bio(struct bio *bio) ...@@ -791,7 +792,7 @@ static blk_status_t btree_csum_one_bio(struct bio *bio)
ASSERT(!bio_flagged(bio, BIO_CLONED)); ASSERT(!bio_flagged(bio, BIO_CLONED));
bio_for_each_segment_all(bvec, bio, iter_all) { bio_for_each_segment_all(bvec, bio, iter_all) {
root = BTRFS_I(bvec->bv_page->mapping->host)->root; root = BTRFS_I(bvec->bv_page->mapping->host)->root;
ret = csum_dirty_buffer(root->fs_info, bvec->bv_page); ret = csum_dirty_buffer(root->fs_info, bvec);
if (ret) if (ret)
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册