* [PATCH v3 11/49] btrfs: avoid access to .bi_vcnt directly
[not found] <20170808084548.18963-1-ming.lei@redhat.com>
@ 2017-08-08 8:45 ` Ming Lei
2017-08-10 11:29 ` Christoph Hellwig
2017-08-08 8:45 ` [PATCH v3 12/49] btrfs: avoid to access bvec table directly for a cloned bio Ming Lei
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Ming Lei @ 2017-08-08 8:45 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Huang Ying, Andrew Morton,
Alexander Viro
Cc: linux-kernel, linux-block, linux-fsdevel, linux-mm, Ming Lei,
Chris Mason, Josef Bacik, David Sterba, linux-btrfs
BTRFS uses bio->bi_vcnt to figure out page numbers, this
way becomes not correct once we start to enable multipage
bvec.
So use bio_for_each_segment_all() to do that instead.
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Acked-by: David Sterba <dsterba@suse.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
fs/btrfs/extent_io.c | 20 ++++++++++++++++----
fs/btrfs/extent_io.h | 2 +-
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 0aff9b278c19..0e7367817b92 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2258,7 +2258,7 @@ int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
return 0;
}
-bool btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
+bool btrfs_check_repairable(struct inode *inode, unsigned failed_bio_pages,
struct io_failure_record *failrec, int failed_mirror)
{
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
@@ -2282,7 +2282,7 @@ bool btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
* a) deliver good data to the caller
* b) correct the bad sectors on disk
*/
- if (failed_bio->bi_vcnt > 1) {
+ if (failed_bio_pages > 1) {
/*
* to fulfill b), we need to know the exact failing sectors, as
* we don't want to rewrite any more than the failed ones. thus,
@@ -2355,6 +2355,17 @@ struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio,
return bio;
}
+static unsigned int get_bio_pages(struct bio *bio)
+{
+ unsigned i;
+ struct bio_vec *bv;
+
+ bio_for_each_segment_all(bv, bio, i)
+ ;
+
+ return i;
+}
+
/*
* this is a generic handler for readpage errors (default
* readpage_io_failed_hook). if other copies exist, read those and write back
@@ -2375,6 +2386,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
int read_mode = 0;
blk_status_t status;
int ret;
+ unsigned failed_bio_pages = get_bio_pages(failed_bio);
BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
@@ -2382,13 +2394,13 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
if (ret)
return ret;
- if (!btrfs_check_repairable(inode, failed_bio, failrec,
+ if (!btrfs_check_repairable(inode, failed_bio_pages, failrec,
failed_mirror)) {
free_io_failure(failure_tree, tree, failrec);
return -EIO;
}
- if (failed_bio->bi_vcnt > 1)
+ if (failed_bio_pages > 1)
read_mode |= REQ_FAILFAST_DEV;
phy_offset >>= inode->i_sb->s_blocksize_bits;
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 4f030912f3ef..300ee10f39f2 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -539,7 +539,7 @@ void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start,
u64 end);
int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
struct io_failure_record **failrec_ret);
-bool btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
+bool btrfs_check_repairable(struct inode *inode, unsigned failed_bio_pages,
struct io_failure_record *failrec, int fail_mirror);
struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio,
struct io_failure_record *failrec,
--
2.9.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v3 11/49] btrfs: avoid access to .bi_vcnt directly
2017-08-08 8:45 ` [PATCH v3 11/49] btrfs: avoid access to .bi_vcnt directly Ming Lei
@ 2017-08-10 11:29 ` Christoph Hellwig
2017-10-19 22:57 ` Ming Lei
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2017-08-10 11:29 UTC (permalink / raw)
To: Ming Lei
Cc: Jens Axboe, Christoph Hellwig, Huang Ying, Andrew Morton,
Alexander Viro, linux-kernel, linux-block, linux-fsdevel,
linux-mm, Chris Mason, Josef Bacik, David Sterba, linux-btrfs
> +static unsigned int get_bio_pages(struct bio *bio)
> +{
> + unsigned i;
> + struct bio_vec *bv;
> +
> + bio_for_each_segment_all(bv, bio, i)
> + ;
> +
> + return i;
> +}
s/get_bio_pages/bio_nr_pages/ ?
Also this seems like a useful helper for bio.h
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v3 11/49] btrfs: avoid access to .bi_vcnt directly
2017-08-10 11:29 ` Christoph Hellwig
@ 2017-10-19 22:57 ` Ming Lei
0 siblings, 0 replies; 9+ messages in thread
From: Ming Lei @ 2017-10-19 22:57 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Huang Ying, Andrew Morton, Alexander Viro,
linux-kernel, linux-block, linux-fsdevel, linux-mm, Chris Mason,
Josef Bacik, David Sterba, linux-btrfs
On Thu, Aug 10, 2017 at 04:29:59AM -0700, Christoph Hellwig wrote:
> > +static unsigned int get_bio_pages(struct bio *bio)
> > +{
> > + unsigned i;
> > + struct bio_vec *bv;
> > +
> > + bio_for_each_segment_all(bv, bio, i)
> > + ;
> > +
> > + return i;
> > +}
>
> s/get_bio_pages/bio_nr_pages/ ?
Yeah, the name of bio_nr_pages() is much better.
>
> Also this seems like a useful helper for bio.h
OK.
--
Ming
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 12/49] btrfs: avoid to access bvec table directly for a cloned bio
[not found] <20170808084548.18963-1-ming.lei@redhat.com>
2017-08-08 8:45 ` [PATCH v3 11/49] btrfs: avoid access to .bi_vcnt directly Ming Lei
@ 2017-08-08 8:45 ` Ming Lei
2017-08-08 8:45 ` [PATCH v3 13/49] btrfs: comment on direct access bvec table Ming Lei
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Ming Lei @ 2017-08-08 8:45 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Huang Ying, Andrew Morton,
Alexander Viro
Cc: linux-kernel, linux-block, linux-fsdevel, linux-mm, Ming Lei,
Chris Mason, Josef Bacik, David Sterba, linux-btrfs, Liu Bo
Commit 17347cec15f919901c90(Btrfs: change how we iterate bios in endio)
mentioned that for dio the submitted bio may be fast cloned, we
can't access the bvec table directly for a cloned bio, so use
bio_get_first_bvec() to retrieve the 1st bvec.
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Cc: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Acked: David Sterba <dsterba@suse.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
fs/btrfs/inode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 95c212037095..5cf320ee7ea0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7993,6 +7993,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
int read_mode = 0;
int segs;
int ret;
+ struct bio_vec bvec;
BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
@@ -8008,8 +8009,9 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
}
segs = bio_segments(failed_bio);
+ bio_get_first_bvec(failed_bio, &bvec);
if (segs > 1 ||
- (failed_bio->bi_io_vec->bv_len > btrfs_inode_sectorsize(inode)))
+ (bvec.bv_len > btrfs_inode_sectorsize(inode)))
read_mode |= REQ_FAILFAST_DEV;
isector = start - btrfs_io_bio(failed_bio)->logical;
--
2.9.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3 13/49] btrfs: comment on direct access bvec table
[not found] <20170808084548.18963-1-ming.lei@redhat.com>
2017-08-08 8:45 ` [PATCH v3 11/49] btrfs: avoid access to .bi_vcnt directly Ming Lei
2017-08-08 8:45 ` [PATCH v3 12/49] btrfs: avoid to access bvec table directly for a cloned bio Ming Lei
@ 2017-08-08 8:45 ` Ming Lei
2017-08-08 8:45 ` [PATCH v3 30/49] btrfs: use bvec_get_last_page to get bio's last page Ming Lei
2017-08-08 8:45 ` [PATCH v3 46/49] fs/btrfs: convert to bio_for_each_segment_all_sp() Ming Lei
4 siblings, 0 replies; 9+ messages in thread
From: Ming Lei @ 2017-08-08 8:45 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Huang Ying, Andrew Morton,
Alexander Viro
Cc: linux-kernel, linux-block, linux-fsdevel, linux-mm, Ming Lei,
Chris Mason, Josef Bacik, David Sterba, linux-btrfs
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Acked: David Sterba <dsterba@suse.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
fs/btrfs/compression.c | 4 ++++
fs/btrfs/inode.c | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index d2ef9ac2a630..f795d0a6d176 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -542,6 +542,10 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
/* we need the actual starting offset of this extent in the file */
read_lock(&em_tree->lock);
+ /*
+ * It is still safe to retrieve the 1st page of the bio
+ * in this way after supporting multipage bvec.
+ */
em = lookup_extent_mapping(em_tree,
page_offset(bio->bi_io_vec->bv_page),
PAGE_SIZE);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5cf320ee7ea0..084ed99dd308 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8051,6 +8051,12 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
if (bio->bi_status)
goto end;
+ /*
+ * WARNING:
+ *
+ * With multipage bvec, the following way of direct access to
+ * bvec table is only safe if the bio includes single page.
+ */
ASSERT(bio->bi_vcnt == 1);
io_tree = &BTRFS_I(inode)->io_tree;
failure_tree = &BTRFS_I(inode)->io_failure_tree;
@@ -8143,6 +8149,12 @@ static void btrfs_retry_endio(struct bio *bio)
uptodate = 1;
+ /*
+ * WARNING:
+ *
+ * With multipage bvec, the following way of direct access to
+ * bvec table is only safe if the bio includes single page.
+ */
ASSERT(bio->bi_vcnt == 1);
ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(done->inode));
--
2.9.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3 30/49] btrfs: use bvec_get_last_page to get bio's last page
[not found] <20170808084548.18963-1-ming.lei@redhat.com>
` (2 preceding siblings ...)
2017-08-08 8:45 ` [PATCH v3 13/49] btrfs: comment on direct access bvec table Ming Lei
@ 2017-08-08 8:45 ` Ming Lei
2017-08-08 8:45 ` [PATCH v3 46/49] fs/btrfs: convert to bio_for_each_segment_all_sp() Ming Lei
4 siblings, 0 replies; 9+ messages in thread
From: Ming Lei @ 2017-08-08 8:45 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Huang Ying, Andrew Morton,
Alexander Viro
Cc: linux-kernel, linux-block, linux-fsdevel, linux-mm, Ming Lei,
Chris Mason, Josef Bacik, David Sterba, linux-btrfs
Preparing for supporting multipage bvec.
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.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 f795d0a6d176..28746588f228 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -392,8 +392,11 @@ blk_status_t 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 bv;
- return page_offset(last->bv_page) + last->bv_len + last->bv_offset;
+ bvec_get_last_page(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 0e7367817b92..c8f6a8657bf2 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2738,11 +2738,15 @@ static int __must_check submit_one_bio(struct bio *bio, int mirror_num,
{
blk_status_t 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 bv;
+ struct page *page;
u64 start;
- start = page_offset(page) + bvec->bv_offset;
+ bvec_get_last_page(bvec, &bv);
+ page = bv.bv_page;
+
+ start = page_offset(page) + bv.bv_offset;
bio->bi_private = NULL;
bio_get(bio);
--
2.9.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3 46/49] fs/btrfs: convert to bio_for_each_segment_all_sp()
[not found] <20170808084548.18963-1-ming.lei@redhat.com>
` (3 preceding siblings ...)
2017-08-08 8:45 ` [PATCH v3 30/49] btrfs: use bvec_get_last_page to get bio's last page Ming Lei
@ 2017-08-08 8:45 ` Ming Lei
2017-08-08 9:00 ` Filipe Manana
2017-08-11 16:54 ` kbuild test robot
4 siblings, 2 replies; 9+ messages in thread
From: Ming Lei @ 2017-08-08 8:45 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Huang Ying, Andrew Morton,
Alexander Viro
Cc: linux-kernel, linux-block, linux-fsdevel, linux-mm, Ming Lei,
Chris Mason, Josef Bacik, David Sterba, linux-btrfs
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
fs/btrfs/compression.c | 3 ++-
fs/btrfs/disk-io.c | 3 ++-
fs/btrfs/extent_io.c | 12 ++++++++----
fs/btrfs/inode.c | 6 ++++--
fs/btrfs/raid56.c | 1 +
5 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 28746588f228..55f251a83d0b 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -147,13 +147,14 @@ static void end_compressed_bio_read(struct bio *bio)
} else {
int i;
struct bio_vec *bvec;
+ struct bvec_iter_all bia;
/*
* we have verified the checksum already, set page
* checked so the end_io handlers know about it
*/
ASSERT(!bio_flagged(bio, BIO_CLONED));
- bio_for_each_segment_all(bvec, cb->orig_bio, i)
+ bio_for_each_segment_all_sp(bvec, cb->orig_bio, i, bia)
SetPageChecked(bvec->bv_page);
bio_endio(cb->orig_bio);
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 080e2ebb8aa0..a9cd75e6383d 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -963,9 +963,10 @@ static blk_status_t btree_csum_one_bio(struct bio *bio)
struct bio_vec *bvec;
struct btrfs_root *root;
int i, ret = 0;
+ struct bvec_iter_all bia;
ASSERT(!bio_flagged(bio, BIO_CLONED));
- bio_for_each_segment_all(bvec, bio, i) {
+ bio_for_each_segment_all_sp(bvec, bio, i, bia) {
root = BTRFS_I(bvec->bv_page->mapping->host)->root;
ret = csum_dirty_buffer(root->fs_info, bvec->bv_page);
if (ret)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index c8f6a8657bf2..4de9cfd1c385 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2359,8 +2359,9 @@ static unsigned int get_bio_pages(struct bio *bio)
{
unsigned i;
struct bio_vec *bv;
+ struct bvec_iter_all bia;
- bio_for_each_segment_all(bv, bio, i)
+ bio_for_each_segment_all_sp(bv, bio, i, bia)
;
return i;
@@ -2463,9 +2464,10 @@ static void end_bio_extent_writepage(struct bio *bio)
u64 start;
u64 end;
int i;
+ struct bvec_iter_all bia;
ASSERT(!bio_flagged(bio, BIO_CLONED));
- bio_for_each_segment_all(bvec, bio, i) {
+ bio_for_each_segment_all_sp(bvec, bio, i, bia) {
struct page *page = bvec->bv_page;
struct inode *inode = page->mapping->host;
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
@@ -2534,9 +2536,10 @@ static void end_bio_extent_readpage(struct bio *bio)
int mirror;
int ret;
int i;
+ struct bvec_iter_all bia;
ASSERT(!bio_flagged(bio, BIO_CLONED));
- bio_for_each_segment_all(bvec, bio, i) {
+ bio_for_each_segment_all_sp(bvec, bio, i, bia) {
struct page *page = bvec->bv_page;
struct inode *inode = page->mapping->host;
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
@@ -3693,9 +3696,10 @@ static void end_bio_extent_buffer_writepage(struct bio *bio)
struct bio_vec *bvec;
struct extent_buffer *eb;
int i, done;
+ struct bvec_iter_all bia;
ASSERT(!bio_flagged(bio, BIO_CLONED));
- bio_for_each_segment_all(bvec, bio, i) {
+ bio_for_each_segment_all_sp(bvec, bio, i, bia) {
struct page *page = bvec->bv_page;
eb = (struct extent_buffer *)page->private;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 084ed99dd308..eeb2ff662ec4 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8047,6 +8047,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
struct bio_vec *bvec;
struct extent_io_tree *io_tree, *failure_tree;
int i;
+ struct bvec_iter_all bia;
if (bio->bi_status)
goto end;
@@ -8064,7 +8065,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
done->uptodate = 1;
ASSERT(!bio_flagged(bio, BIO_CLONED));
- bio_for_each_segment_all(bvec, bio, i)
+ bio_for_each_segment_all_sp(bvec, bio, i, bia)
clean_io_failure(BTRFS_I(inode)->root->fs_info, failure_tree,
io_tree, done->start, bvec->bv_page,
btrfs_ino(BTRFS_I(inode)), 0);
@@ -8143,6 +8144,7 @@ static void btrfs_retry_endio(struct bio *bio)
int uptodate;
int ret;
int i;
+ struct bvec_iter_all bia;
if (bio->bi_status)
goto end;
@@ -8162,7 +8164,7 @@ static void btrfs_retry_endio(struct bio *bio)
failure_tree = &BTRFS_I(inode)->io_failure_tree;
ASSERT(!bio_flagged(bio, BIO_CLONED));
- bio_for_each_segment_all(bvec, bio, i) {
+ bio_for_each_segment_all_sp(bvec, bio, i, bia) {
ret = __readpage_endio_check(inode, io_bio, i, bvec->bv_page,
bvec->bv_offset, done->start,
bvec->bv_len);
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 208638384cd2..9247226a2efd 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1365,6 +1365,7 @@ static int find_logical_bio_stripe(struct btrfs_raid_bio *rbio,
u64 logical = bio->bi_iter.bi_sector;
u64 stripe_start;
int i;
+ struct bvec_iter_all bia;
logical <<= 9;
--
2.9.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v3 46/49] fs/btrfs: convert to bio_for_each_segment_all_sp()
2017-08-08 8:45 ` [PATCH v3 46/49] fs/btrfs: convert to bio_for_each_segment_all_sp() Ming Lei
@ 2017-08-08 9:00 ` Filipe Manana
2017-08-11 16:54 ` kbuild test robot
1 sibling, 0 replies; 9+ messages in thread
From: Filipe Manana @ 2017-08-08 9:00 UTC (permalink / raw)
To: Ming Lei
Cc: Jens Axboe, Christoph Hellwig, Huang Ying, Andrew Morton,
Alexander Viro, linux-kernel@vger.kernel.org, linux-block,
linux-fsdevel, linux-mm, Chris Mason, Josef Bacik, David Sterba,
linux-btrfs@vger.kernel.org
On Tue, Aug 8, 2017 at 9:45 AM, Ming Lei <ming.lei@redhat.com> wrote:
> Cc: Chris Mason <clm@fb.com>
> Cc: Josef Bacik <jbacik@fb.com>
> Cc: David Sterba <dsterba@suse.com>
> Cc: linux-btrfs@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
Can you please add some meaningful changelog? E.g., why is this
conversion needed.
> ---
> fs/btrfs/compression.c | 3 ++-
> fs/btrfs/disk-io.c | 3 ++-
> fs/btrfs/extent_io.c | 12 ++++++++----
> fs/btrfs/inode.c | 6 ++++--
> fs/btrfs/raid56.c | 1 +
> 5 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index 28746588f228..55f251a83d0b 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -147,13 +147,14 @@ static void end_compressed_bio_read(struct bio *bio)
> } else {
> int i;
> struct bio_vec *bvec;
> + struct bvec_iter_all bia;
>
> /*
> * we have verified the checksum already, set page
> * checked so the end_io handlers know about it
> */
> ASSERT(!bio_flagged(bio, BIO_CLONED));
> - bio_for_each_segment_all(bvec, cb->orig_bio, i)
> + bio_for_each_segment_all_sp(bvec, cb->orig_bio, i, bia)
> SetPageChecked(bvec->bv_page);
>
> bio_endio(cb->orig_bio);
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 080e2ebb8aa0..a9cd75e6383d 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -963,9 +963,10 @@ static blk_status_t btree_csum_one_bio(struct bio *bio)
> struct bio_vec *bvec;
> struct btrfs_root *root;
> int i, ret = 0;
> + struct bvec_iter_all bia;
>
> ASSERT(!bio_flagged(bio, BIO_CLONED));
> - bio_for_each_segment_all(bvec, bio, i) {
> + bio_for_each_segment_all_sp(bvec, bio, i, bia) {
> root = BTRFS_I(bvec->bv_page->mapping->host)->root;
> ret = csum_dirty_buffer(root->fs_info, bvec->bv_page);
> if (ret)
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index c8f6a8657bf2..4de9cfd1c385 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -2359,8 +2359,9 @@ static unsigned int get_bio_pages(struct bio *bio)
> {
> unsigned i;
> struct bio_vec *bv;
> + struct bvec_iter_all bia;
>
> - bio_for_each_segment_all(bv, bio, i)
> + bio_for_each_segment_all_sp(bv, bio, i, bia)
> ;
>
> return i;
> @@ -2463,9 +2464,10 @@ static void end_bio_extent_writepage(struct bio *bio)
> u64 start;
> u64 end;
> int i;
> + struct bvec_iter_all bia;
>
> ASSERT(!bio_flagged(bio, BIO_CLONED));
> - bio_for_each_segment_all(bvec, bio, i) {
> + bio_for_each_segment_all_sp(bvec, bio, i, bia) {
> struct page *page = bvec->bv_page;
> struct inode *inode = page->mapping->host;
> struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
> @@ -2534,9 +2536,10 @@ static void end_bio_extent_readpage(struct bio *bio)
> int mirror;
> int ret;
> int i;
> + struct bvec_iter_all bia;
>
> ASSERT(!bio_flagged(bio, BIO_CLONED));
> - bio_for_each_segment_all(bvec, bio, i) {
> + bio_for_each_segment_all_sp(bvec, bio, i, bia) {
> struct page *page = bvec->bv_page;
> struct inode *inode = page->mapping->host;
> struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
> @@ -3693,9 +3696,10 @@ static void end_bio_extent_buffer_writepage(struct bio *bio)
> struct bio_vec *bvec;
> struct extent_buffer *eb;
> int i, done;
> + struct bvec_iter_all bia;
>
> ASSERT(!bio_flagged(bio, BIO_CLONED));
> - bio_for_each_segment_all(bvec, bio, i) {
> + bio_for_each_segment_all_sp(bvec, bio, i, bia) {
> struct page *page = bvec->bv_page;
>
> eb = (struct extent_buffer *)page->private;
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 084ed99dd308..eeb2ff662ec4 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -8047,6 +8047,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
> struct bio_vec *bvec;
> struct extent_io_tree *io_tree, *failure_tree;
> int i;
> + struct bvec_iter_all bia;
>
> if (bio->bi_status)
> goto end;
> @@ -8064,7 +8065,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
>
> done->uptodate = 1;
> ASSERT(!bio_flagged(bio, BIO_CLONED));
> - bio_for_each_segment_all(bvec, bio, i)
> + bio_for_each_segment_all_sp(bvec, bio, i, bia)
> clean_io_failure(BTRFS_I(inode)->root->fs_info, failure_tree,
> io_tree, done->start, bvec->bv_page,
> btrfs_ino(BTRFS_I(inode)), 0);
> @@ -8143,6 +8144,7 @@ static void btrfs_retry_endio(struct bio *bio)
> int uptodate;
> int ret;
> int i;
> + struct bvec_iter_all bia;
>
> if (bio->bi_status)
> goto end;
> @@ -8162,7 +8164,7 @@ static void btrfs_retry_endio(struct bio *bio)
> failure_tree = &BTRFS_I(inode)->io_failure_tree;
>
> ASSERT(!bio_flagged(bio, BIO_CLONED));
> - bio_for_each_segment_all(bvec, bio, i) {
> + bio_for_each_segment_all_sp(bvec, bio, i, bia) {
> ret = __readpage_endio_check(inode, io_bio, i, bvec->bv_page,
> bvec->bv_offset, done->start,
> bvec->bv_len);
> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> index 208638384cd2..9247226a2efd 100644
> --- a/fs/btrfs/raid56.c
> +++ b/fs/btrfs/raid56.c
> @@ -1365,6 +1365,7 @@ static int find_logical_bio_stripe(struct btrfs_raid_bio *rbio,
> u64 logical = bio->bi_iter.bi_sector;
> u64 stripe_start;
> int i;
> + struct bvec_iter_all bia;
Unused variable.
Thanks.
>
> logical <<= 9;
>
> --
> 2.9.4
>
--
Filipe David Manana,
“Whether you think you can, or you think you can't — you're right.”
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v3 46/49] fs/btrfs: convert to bio_for_each_segment_all_sp()
2017-08-08 8:45 ` [PATCH v3 46/49] fs/btrfs: convert to bio_for_each_segment_all_sp() Ming Lei
2017-08-08 9:00 ` Filipe Manana
@ 2017-08-11 16:54 ` kbuild test robot
1 sibling, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2017-08-11 16:54 UTC (permalink / raw)
To: Ming Lei
Cc: kbuild-all, Jens Axboe, Christoph Hellwig, Huang Ying,
Andrew Morton, Alexander Viro, linux-kernel, linux-block,
linux-fsdevel, linux-mm, Ming Lei, Chris Mason, Josef Bacik,
David Sterba, linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]
Hi Ming,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.13-rc4 next-20170810]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ming-Lei/block-support-multipage-bvec/20170810-110521
config: x86_64-randconfig-b0-08112217 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
fs/btrfs/raid56.c: In function 'find_logical_bio_stripe':
>> fs/btrfs/raid56.c:1368: warning: unused variable 'bia'
vim +/bia +1368 fs/btrfs/raid56.c
1356
1357 /*
1358 * helper to find the stripe number for a given
1359 * bio (before mapping). Used to figure out which stripe has
1360 * failed. This looks up based on logical block numbers.
1361 */
1362 static int find_logical_bio_stripe(struct btrfs_raid_bio *rbio,
1363 struct bio *bio)
1364 {
1365 u64 logical = bio->bi_iter.bi_sector;
1366 u64 stripe_start;
1367 int i;
> 1368 struct bvec_iter_all bia;
1369
1370 logical <<= 9;
1371
1372 for (i = 0; i < rbio->nr_data; i++) {
1373 stripe_start = rbio->bbio->raid_map[i];
1374 if (logical >= stripe_start &&
1375 logical < stripe_start + rbio->stripe_len) {
1376 return i;
1377 }
1378 }
1379 return -1;
1380 }
1381
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28376 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread