diff options
author | Christoph Hellwig <hch@lst.de> | 2016-11-25 09:07:51 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-11-30 13:45:20 +0100 |
commit | 2a4d0c9068a6cbd94086953e45625505891490b2 (patch) | |
tree | 7f5af26489c2a264f248444a8f7423ff14ebea3a /fs/btrfs/compression.c | |
parent | 81381053d094a3098d27eba7bb9b9aaf0e197a4a (diff) | |
download | talos-obmc-linux-2a4d0c9068a6cbd94086953e45625505891490b2.tar.gz talos-obmc-linux-2a4d0c9068a6cbd94086953e45625505891490b2.zip |
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>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 10 |
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, return 0; } +static u64 bio_end_offset(struct bio *bio) +{ + struct bio_vec *last = &bio->bi_io_vec[bio->bi_vcnt - 1]; + + return page_offset(last->bv_page) + last->bv_len + last->bv_offset; +} + static noinline int add_ra_bio_pages(struct inode *inode, u64 compressed_end, struct compressed_bio *cb) @@ -463,8 +470,7 @@ static noinline int add_ra_bio_pages(struct inode *inode, u64 end; int misses = 0; - page = cb->orig_bio->bi_io_vec[cb->orig_bio->bi_vcnt - 1].bv_page; - last_offset = (page_offset(page) + PAGE_SIZE); + last_offset = bio_end_offset(cb->orig_bio); em_tree = &BTRFS_I(inode)->extent_tree; tree = &BTRFS_I(inode)->io_tree; |