[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1482854706-14128-21-git-send-email-tom.leiming@gmail.com>
Date: Wed, 28 Dec 2016 00:05:01 +0800
From: Ming Lei <tom.leiming@...il.com>
To: Jens Axboe <axboe@...com>, linux-kernel@...r.kernel.org
Cc: linux-block@...r.kernel.org, Christoph Hellwig <hch@...radead.org>,
Ming Lei <tom.leiming@...il.com>, Chris Mason <clm@...com>,
Josef Bacik <jbacik@...com>, David Sterba <dsterba@...e.com>,
linux-btrfs@...r.kernel.org (open list:BTRFS FILE SYSTEM)
Subject: [PATCH v1 52/54] btrfs: use bvec_get_last_sp to get the last singlepage bvec
Preparing for supporting multipage bvec.
Signed-off-by: Ming Lei <tom.leiming@...il.com>
---
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
Powered by blists - more mailing lists