btrfs: use mp_bvec_last_segment to get bio's last page
authorMing Lei <[email protected]>
Fri, 15 Feb 2019 11:13:16 +0000 (19:13 +0800)
committerJens Axboe <[email protected]>
Fri, 15 Feb 2019 15:40:11 +0000 (08:40 -0700)
Preparing for supporting multi-page bvec.

Reviewed-by: Omar Sandoval <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
fs/btrfs/extent_io.c

index dc8ba3ee515d6348df5f5d10da8f5487ca6991de..986ef49b02696bc2027144e15f3586785677a7cb 100644 (file)
@@ -2697,11 +2697,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;