diff options
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 1499b27b4186..e2600cdb6c25 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -128,11 +128,10 @@ static int check_compressed_csum(struct inode *inode, | |||
128 | kunmap_atomic(kaddr); | 128 | kunmap_atomic(kaddr); |
129 | 129 | ||
130 | if (csum != *cb_sum) { | 130 | if (csum != *cb_sum) { |
131 | printk(KERN_INFO "btrfs csum failed ino %llu " | 131 | btrfs_info(BTRFS_I(inode)->root->fs_info, |
132 | "extent %llu csum %u " | 132 | "csum failed ino %llu extent %llu csum %u wanted %u mirror %d", |
133 | "wanted %u mirror %d\n", | 133 | btrfs_ino(inode), disk_start, csum, *cb_sum, |
134 | btrfs_ino(inode), disk_start, csum, *cb_sum, | 134 | cb->mirror_num); |
135 | cb->mirror_num); | ||
136 | ret = -EIO; | 135 | ret = -EIO; |
137 | goto fail; | 136 | goto fail; |
138 | } | 137 | } |
@@ -172,7 +171,8 @@ static void end_compressed_bio_read(struct bio *bio, int err) | |||
172 | goto out; | 171 | goto out; |
173 | 172 | ||
174 | inode = cb->inode; | 173 | inode = cb->inode; |
175 | ret = check_compressed_csum(inode, cb, (u64)bio->bi_sector << 9); | 174 | ret = check_compressed_csum(inode, cb, |
175 | (u64)bio->bi_iter.bi_sector << 9); | ||
176 | if (ret) | 176 | if (ret) |
177 | goto csum_failed; | 177 | goto csum_failed; |
178 | 178 | ||
@@ -201,18 +201,16 @@ csum_failed: | |||
201 | if (cb->errors) { | 201 | if (cb->errors) { |
202 | bio_io_error(cb->orig_bio); | 202 | bio_io_error(cb->orig_bio); |
203 | } else { | 203 | } else { |
204 | int bio_index = 0; | 204 | int i; |
205 | struct bio_vec *bvec = cb->orig_bio->bi_io_vec; | 205 | struct bio_vec *bvec; |
206 | 206 | ||
207 | /* | 207 | /* |
208 | * we have verified the checksum already, set page | 208 | * we have verified the checksum already, set page |
209 | * checked so the end_io handlers know about it | 209 | * checked so the end_io handlers know about it |
210 | */ | 210 | */ |
211 | while (bio_index < cb->orig_bio->bi_vcnt) { | 211 | bio_for_each_segment_all(bvec, cb->orig_bio, i) |
212 | SetPageChecked(bvec->bv_page); | 212 | SetPageChecked(bvec->bv_page); |
213 | bvec++; | 213 | |
214 | bio_index++; | ||
215 | } | ||
216 | bio_endio(cb->orig_bio, 0); | 214 | bio_endio(cb->orig_bio, 0); |
217 | } | 215 | } |
218 | 216 | ||
@@ -372,7 +370,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
372 | for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) { | 370 | for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) { |
373 | page = compressed_pages[pg_index]; | 371 | page = compressed_pages[pg_index]; |
374 | page->mapping = inode->i_mapping; | 372 | page->mapping = inode->i_mapping; |
375 | if (bio->bi_size) | 373 | if (bio->bi_iter.bi_size) |
376 | ret = io_tree->ops->merge_bio_hook(WRITE, page, 0, | 374 | ret = io_tree->ops->merge_bio_hook(WRITE, page, 0, |
377 | PAGE_CACHE_SIZE, | 375 | PAGE_CACHE_SIZE, |
378 | bio, 0); | 376 | bio, 0); |
@@ -412,7 +410,8 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
412 | bio_add_page(bio, page, PAGE_CACHE_SIZE, 0); | 410 | bio_add_page(bio, page, PAGE_CACHE_SIZE, 0); |
413 | } | 411 | } |
414 | if (bytes_left < PAGE_CACHE_SIZE) { | 412 | if (bytes_left < PAGE_CACHE_SIZE) { |
415 | printk("bytes left %lu compress len %lu nr %lu\n", | 413 | btrfs_info(BTRFS_I(inode)->root->fs_info, |
414 | "bytes left %lu compress len %lu nr %lu", | ||
416 | bytes_left, cb->compressed_len, cb->nr_pages); | 415 | bytes_left, cb->compressed_len, cb->nr_pages); |
417 | } | 416 | } |
418 | bytes_left -= PAGE_CACHE_SIZE; | 417 | bytes_left -= PAGE_CACHE_SIZE; |
@@ -506,7 +505,7 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
506 | 505 | ||
507 | if (!em || last_offset < em->start || | 506 | if (!em || last_offset < em->start || |
508 | (last_offset + PAGE_CACHE_SIZE > extent_map_end(em)) || | 507 | (last_offset + PAGE_CACHE_SIZE > extent_map_end(em)) || |
509 | (em->block_start >> 9) != cb->orig_bio->bi_sector) { | 508 | (em->block_start >> 9) != cb->orig_bio->bi_iter.bi_sector) { |
510 | free_extent_map(em); | 509 | free_extent_map(em); |
511 | unlock_extent(tree, last_offset, end); | 510 | unlock_extent(tree, last_offset, end); |
512 | unlock_page(page); | 511 | unlock_page(page); |
@@ -552,7 +551,7 @@ next: | |||
552 | * in it. We don't actually do IO on those pages but allocate new ones | 551 | * in it. We don't actually do IO on those pages but allocate new ones |
553 | * to hold the compressed pages on disk. | 552 | * to hold the compressed pages on disk. |
554 | * | 553 | * |
555 | * bio->bi_sector points to the compressed extent on disk | 554 | * bio->bi_iter.bi_sector points to the compressed extent on disk |
556 | * bio->bi_io_vec points to all of the inode pages | 555 | * bio->bi_io_vec points to all of the inode pages |
557 | * bio->bi_vcnt is a count of pages | 556 | * bio->bi_vcnt is a count of pages |
558 | * | 557 | * |
@@ -573,7 +572,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
573 | struct page *page; | 572 | struct page *page; |
574 | struct block_device *bdev; | 573 | struct block_device *bdev; |
575 | struct bio *comp_bio; | 574 | struct bio *comp_bio; |
576 | u64 cur_disk_byte = (u64)bio->bi_sector << 9; | 575 | u64 cur_disk_byte = (u64)bio->bi_iter.bi_sector << 9; |
577 | u64 em_len; | 576 | u64 em_len; |
578 | u64 em_start; | 577 | u64 em_start; |
579 | struct extent_map *em; | 578 | struct extent_map *em; |
@@ -659,7 +658,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
659 | page->mapping = inode->i_mapping; | 658 | page->mapping = inode->i_mapping; |
660 | page->index = em_start >> PAGE_CACHE_SHIFT; | 659 | page->index = em_start >> PAGE_CACHE_SHIFT; |
661 | 660 | ||
662 | if (comp_bio->bi_size) | 661 | if (comp_bio->bi_iter.bi_size) |
663 | ret = tree->ops->merge_bio_hook(READ, page, 0, | 662 | ret = tree->ops->merge_bio_hook(READ, page, 0, |
664 | PAGE_CACHE_SIZE, | 663 | PAGE_CACHE_SIZE, |
665 | comp_bio, 0); | 664 | comp_bio, 0); |
@@ -687,8 +686,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
687 | comp_bio, sums); | 686 | comp_bio, sums); |
688 | BUG_ON(ret); /* -ENOMEM */ | 687 | BUG_ON(ret); /* -ENOMEM */ |
689 | } | 688 | } |
690 | sums += (comp_bio->bi_size + root->sectorsize - 1) / | 689 | sums += (comp_bio->bi_iter.bi_size + |
691 | root->sectorsize; | 690 | root->sectorsize - 1) / root->sectorsize; |
692 | 691 | ||
693 | ret = btrfs_map_bio(root, READ, comp_bio, | 692 | ret = btrfs_map_bio(root, READ, comp_bio, |
694 | mirror_num, 0); | 693 | mirror_num, 0); |