aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-11-25 03:07:51 -0500
committerDavid Sterba <dsterba@suse.com>2016-11-30 07:45:20 -0500
commit2a4d0c9068a6cbd94086953e45625505891490b2 (patch)
tree7f5af26489c2a264f248444a8f7423ff14ebea3a
parent81381053d094a3098d27eba7bb9b9aaf0e197a4a (diff)
btrfs: calculate end of bio offset properly
Use the bvec offset and len members to prepare for multipage bvecs. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/compression.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 1a618cb5370b..ae4c000cbffc 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -445,6 +445,13 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
445 return 0; 445 return 0;
446} 446}
447 447
448static u64 bio_end_offset(struct bio *bio)
449{
450 struct bio_vec *last = &bio->bi_io_vec[bio->bi_vcnt - 1];
451
452 return page_offset(last->bv_page) + last->bv_len + last->bv_offset;
453}
454
448static noinline int add_ra_bio_pages(struct inode *inode, 455static noinline int add_ra_bio_pages(struct inode *inode,
449 u64 compressed_end, 456 u64 compressed_end,
450 struct compressed_bio *cb) 457 struct compressed_bio *cb)
@@ -463,8 +470,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
463 u64 end; 470 u64 end;
464 int misses = 0; 471 int misses = 0;
465 472
466 page = cb->orig_bio->bi_io_vec[cb->orig_bio->bi_vcnt - 1].bv_page; 473 last_offset = bio_end_offset(cb->orig_bio);
467 last_offset = (page_offset(page) + PAGE_SIZE);
468 em_tree = &BTRFS_I(inode)->extent_tree; 474 em_tree = &BTRFS_I(inode)->extent_tree;
469 tree = &BTRFS_I(inode)->io_tree; 475 tree = &BTRFS_I(inode)->io_tree;
470 476