Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933131AbcL0QHp (ORCPT ); Tue, 27 Dec 2016 11:07:45 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33889 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933088AbcL0QH0 (ORCPT ); Tue, 27 Dec 2016 11:07:26 -0500 From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org (open list:BTRFS FILE SYSTEM) Subject: [PATCH v1 52/54] btrfs: use bvec_get_last_sp to get the last singlepage bvec Date: Wed, 28 Dec 2016 00:05:01 +0800 Message-Id: <1482854706-14128-21-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482854706-14128-1-git-send-email-tom.leiming@gmail.com> References: <1482854706-14128-1-git-send-email-tom.leiming@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1526 Lines: 49 Preparing for supporting multipage bvec. Signed-off-by: Ming Lei --- fs/btrfs/compression.c | 5 ++++- fs/btrfs/extent_io.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index adcf5568f010..485a60923bba 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -448,8 +448,11 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, static u64 bio_end_offset(struct bio *bio) { struct bio_vec *last = &bio->bi_io_vec[bio->bi_vcnt - 1]; + struct bio_vec uninitialized_var(bv); - return page_offset(last->bv_page) + last->bv_len + last->bv_offset; + bvec_get_last_sp(last, &bv); + + return page_offset(bv.bv_page) + bv.bv_len + bv.bv_offset; } static noinline int add_ra_bio_pages(struct inode *inode, diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 3c021f4dd8bf..4a1c81cee883 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2733,11 +2733,15 @@ static int __must_check submit_one_bio(struct bio *bio, int mirror_num, { int ret = 0; struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; - struct page *page = bvec->bv_page; struct extent_io_tree *tree = bio->bi_private; + struct bio_vec uninitialized_var(bv); + struct page *page; u64 start; - start = page_offset(page) + bvec->bv_offset; + bvec_get_last_sp(bvec, &bv); + page = bv.bv_page; + + start = page_offset(page) + bv.bv_offset; bio->bi_private = NULL; bio_get(bio); -- 2.7.4