diff options
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 1499b27b4186..f5cdeb4b5538 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -172,7 +172,8 @@ static void end_compressed_bio_read(struct bio *bio, int err) | |||
172 | goto out; | 172 | goto out; |
173 | 173 | ||
174 | inode = cb->inode; | 174 | inode = cb->inode; |
175 | ret = check_compressed_csum(inode, cb, (u64)bio->bi_sector << 9); | 175 | ret = check_compressed_csum(inode, cb, |
176 | (u64)bio->bi_iter.bi_sector << 9); | ||
176 | if (ret) | 177 | if (ret) |
177 | goto csum_failed; | 178 | goto csum_failed; |
178 | 179 | ||
@@ -201,18 +202,16 @@ csum_failed: | |||
201 | if (cb->errors) { | 202 | if (cb->errors) { |
202 | bio_io_error(cb->orig_bio); | 203 | bio_io_error(cb->orig_bio); |
203 | } else { | 204 | } else { |
204 | int bio_index = 0; | 205 | int i; |
205 | struct bio_vec *bvec = cb->orig_bio->bi_io_vec; | 206 | struct bio_vec *bvec; |
206 | 207 | ||
207 | /* | 208 | /* |
208 | * we have verified the checksum already, set page | 209 | * we have verified the checksum already, set page |
209 | * checked so the end_io handlers know about it | 210 | * checked so the end_io handlers know about it |
210 | */ | 211 | */ |
211 | while (bio_index < cb->orig_bio->bi_vcnt) { | 212 | bio_for_each_segment_all(bvec, cb->orig_bio, i) |
212 | SetPageChecked(bvec->bv_page); | 213 | SetPageChecked(bvec->bv_page); |
213 | bvec++; | 214 | |
214 | bio_index++; | ||
215 | } | ||
216 | bio_endio(cb->orig_bio, 0); | 215 | bio_endio(cb->orig_bio, 0); |
217 | } | 216 | } |
218 | 217 | ||
@@ -372,7 +371,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
372 | for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) { | 371 | for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) { |
373 | page = compressed_pages[pg_index]; | 372 | page = compressed_pages[pg_index]; |
374 | page->mapping = inode->i_mapping; | 373 | page->mapping = inode->i_mapping; |
375 | if (bio->bi_size) | 374 | if (bio->bi_iter.bi_size) |
376 | ret = io_tree->ops->merge_bio_hook(WRITE, page, 0, | 375 | ret = io_tree->ops->merge_bio_hook(WRITE, page, 0, |
377 | PAGE_CACHE_SIZE, | 376 | PAGE_CACHE_SIZE, |
378 | bio, 0); | 377 | bio, 0); |
@@ -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); |