Merge tag 'for-5.1-part2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[sfrench/cifs-2.6.git] / fs / btrfs / extent_io.c
index ca259c75bbcd1a32f462cfada377362ddfa2c8ca..ca8b8e785cf3a17f963449058210d1f0ff4cfd0d 100644 (file)
@@ -152,11 +152,12 @@ static int __must_check submit_one_bio(struct bio *bio, int mirror_num,
 {
        blk_status_t ret = 0;
        struct bio_vec *bvec = bio_last_bvec_all(bio);
-       struct page *page = bvec->bv_page;
+       struct bio_vec bv;
        struct extent_io_tree *tree = bio->bi_private;
        u64 start;
 
-       start = page_offset(page) + bvec->bv_offset;
+       mp_bvec_last_segment(bvec, &bv);
+       start = page_offset(bv.bv_page) + bv.bv_offset;
 
        bio->bi_private = NULL;
 
@@ -2379,7 +2380,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
        int read_mode = 0;
        blk_status_t status;
        int ret;
-       unsigned failed_bio_pages = bio_pages_all(failed_bio);
+       unsigned failed_bio_pages = failed_bio->bi_iter.bi_size >> PAGE_SHIFT;
 
        BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
 
@@ -2451,9 +2452,10 @@ static void end_bio_extent_writepage(struct bio *bio)
        u64 start;
        u64 end;
        int i;
+       struct bvec_iter_all iter_all;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i) {
+       bio_for_each_segment_all(bvec, bio, i, iter_all) {
                struct page *page = bvec->bv_page;
                struct inode *inode = page->mapping->host;
                struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
@@ -2522,9 +2524,10 @@ static void end_bio_extent_readpage(struct bio *bio)
        int mirror;
        int ret;
        int i;
+       struct bvec_iter_all iter_all;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i) {
+       bio_for_each_segment_all(bvec, bio, i, iter_all) {
                struct page *page = bvec->bv_page;
                struct inode *inode = page->mapping->host;
                struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
@@ -2992,11 +2995,11 @@ static int __do_readpage(struct extent_io_tree *tree,
                 */
                if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags) &&
                    prev_em_start && *prev_em_start != (u64)-1 &&
-                   *prev_em_start != em->orig_start)
+                   *prev_em_start != em->start)
                        force_bio_submit = true;
 
                if (prev_em_start)
-                       *prev_em_start = em->orig_start;
+                       *prev_em_start = em->start;
 
                free_extent_map(em);
                em = NULL;
@@ -3641,9 +3644,10 @@ static void end_bio_extent_buffer_writepage(struct bio *bio)
        struct bio_vec *bvec;
        struct extent_buffer *eb;
        int i, done;
+       struct bvec_iter_all iter_all;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i) {
+       bio_for_each_segment_all(bvec, bio, i, iter_all) {
                struct page *page = bvec->bv_page;
 
                eb = (struct extent_buffer *)page->private;