diff options
author | Christoph Hellwig <hch@lst.de> | 2017-06-03 03:38:06 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-06-09 11:27:32 -0400 |
commit | 4e4cbee93d56137ebff722be022cae5f70ef84fb (patch) | |
tree | 4fa7345155599fc6bdd653fca8c5224ddf90a5be /fs/btrfs/extent_io.c | |
parent | fc17b6534eb8395f0b3133eb31d87deec32c642b (diff) |
block: switch bios to blk_status_t
Replace bi_error with a new bi_status to allow for a clear conversion.
Note that device mapper overloaded bi_error with a private value, which
we'll have to keep arround at least for now and thus propagate to a
proper blk_status_t value.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index d8da3edf2ac3..35cbb6ceb70d 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2399,6 +2399,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, | |||
2399 | struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; | 2399 | struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; |
2400 | struct bio *bio; | 2400 | struct bio *bio; |
2401 | int read_mode = 0; | 2401 | int read_mode = 0; |
2402 | blk_status_t status; | ||
2402 | int ret; | 2403 | int ret; |
2403 | 2404 | ||
2404 | BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE); | 2405 | BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE); |
@@ -2431,11 +2432,12 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, | |||
2431 | "Repair Read Error: submitting new read[%#x] to this_mirror=%d, in_validation=%d", | 2432 | "Repair Read Error: submitting new read[%#x] to this_mirror=%d, in_validation=%d", |
2432 | read_mode, failrec->this_mirror, failrec->in_validation); | 2433 | read_mode, failrec->this_mirror, failrec->in_validation); |
2433 | 2434 | ||
2434 | ret = tree->ops->submit_bio_hook(inode, bio, failrec->this_mirror, | 2435 | status = tree->ops->submit_bio_hook(inode, bio, failrec->this_mirror, |
2435 | failrec->bio_flags, 0); | 2436 | failrec->bio_flags, 0); |
2436 | if (ret) { | 2437 | if (status) { |
2437 | free_io_failure(BTRFS_I(inode), failrec); | 2438 | free_io_failure(BTRFS_I(inode), failrec); |
2438 | bio_put(bio); | 2439 | bio_put(bio); |
2440 | ret = blk_status_to_errno(status); | ||
2439 | } | 2441 | } |
2440 | 2442 | ||
2441 | return ret; | 2443 | return ret; |
@@ -2474,6 +2476,7 @@ void end_extent_writepage(struct page *page, int err, u64 start, u64 end) | |||
2474 | */ | 2476 | */ |
2475 | static void end_bio_extent_writepage(struct bio *bio) | 2477 | static void end_bio_extent_writepage(struct bio *bio) |
2476 | { | 2478 | { |
2479 | int error = blk_status_to_errno(bio->bi_status); | ||
2477 | struct bio_vec *bvec; | 2480 | struct bio_vec *bvec; |
2478 | u64 start; | 2481 | u64 start; |
2479 | u64 end; | 2482 | u64 end; |
@@ -2503,7 +2506,7 @@ static void end_bio_extent_writepage(struct bio *bio) | |||
2503 | start = page_offset(page); | 2506 | start = page_offset(page); |
2504 | end = start + bvec->bv_offset + bvec->bv_len - 1; | 2507 | end = start + bvec->bv_offset + bvec->bv_len - 1; |
2505 | 2508 | ||
2506 | end_extent_writepage(page, bio->bi_error, start, end); | 2509 | end_extent_writepage(page, error, start, end); |
2507 | end_page_writeback(page); | 2510 | end_page_writeback(page); |
2508 | } | 2511 | } |
2509 | 2512 | ||
@@ -2536,7 +2539,7 @@ endio_readpage_release_extent(struct extent_io_tree *tree, u64 start, u64 len, | |||
2536 | static void end_bio_extent_readpage(struct bio *bio) | 2539 | static void end_bio_extent_readpage(struct bio *bio) |
2537 | { | 2540 | { |
2538 | struct bio_vec *bvec; | 2541 | struct bio_vec *bvec; |
2539 | int uptodate = !bio->bi_error; | 2542 | int uptodate = !bio->bi_status; |
2540 | struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); | 2543 | struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); |
2541 | struct extent_io_tree *tree; | 2544 | struct extent_io_tree *tree; |
2542 | u64 offset = 0; | 2545 | u64 offset = 0; |
@@ -2556,7 +2559,7 @@ static void end_bio_extent_readpage(struct bio *bio) | |||
2556 | 2559 | ||
2557 | btrfs_debug(fs_info, | 2560 | btrfs_debug(fs_info, |
2558 | "end_bio_extent_readpage: bi_sector=%llu, err=%d, mirror=%u", | 2561 | "end_bio_extent_readpage: bi_sector=%llu, err=%d, mirror=%u", |
2559 | (u64)bio->bi_iter.bi_sector, bio->bi_error, | 2562 | (u64)bio->bi_iter.bi_sector, bio->bi_status, |
2560 | io_bio->mirror_num); | 2563 | io_bio->mirror_num); |
2561 | tree = &BTRFS_I(inode)->io_tree; | 2564 | tree = &BTRFS_I(inode)->io_tree; |
2562 | 2565 | ||
@@ -2615,7 +2618,7 @@ static void end_bio_extent_readpage(struct bio *bio) | |||
2615 | ret = bio_readpage_error(bio, offset, page, | 2618 | ret = bio_readpage_error(bio, offset, page, |
2616 | start, end, mirror); | 2619 | start, end, mirror); |
2617 | if (ret == 0) { | 2620 | if (ret == 0) { |
2618 | uptodate = !bio->bi_error; | 2621 | uptodate = !bio->bi_status; |
2619 | offset += len; | 2622 | offset += len; |
2620 | continue; | 2623 | continue; |
2621 | } | 2624 | } |
@@ -2673,7 +2676,7 @@ readpage_ok: | |||
2673 | endio_readpage_release_extent(tree, extent_start, extent_len, | 2676 | endio_readpage_release_extent(tree, extent_start, extent_len, |
2674 | uptodate); | 2677 | uptodate); |
2675 | if (io_bio->end_io) | 2678 | if (io_bio->end_io) |
2676 | io_bio->end_io(io_bio, bio->bi_error); | 2679 | io_bio->end_io(io_bio, blk_status_to_errno(bio->bi_status)); |
2677 | bio_put(bio); | 2680 | bio_put(bio); |
2678 | } | 2681 | } |
2679 | 2682 | ||
@@ -2743,7 +2746,7 @@ struct bio *btrfs_io_bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) | |||
2743 | static int __must_check submit_one_bio(struct bio *bio, int mirror_num, | 2746 | static int __must_check submit_one_bio(struct bio *bio, int mirror_num, |
2744 | unsigned long bio_flags) | 2747 | unsigned long bio_flags) |
2745 | { | 2748 | { |
2746 | int ret = 0; | 2749 | blk_status_t ret = 0; |
2747 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | 2750 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; |
2748 | struct page *page = bvec->bv_page; | 2751 | struct page *page = bvec->bv_page; |
2749 | struct extent_io_tree *tree = bio->bi_private; | 2752 | struct extent_io_tree *tree = bio->bi_private; |
@@ -2761,7 +2764,7 @@ static int __must_check submit_one_bio(struct bio *bio, int mirror_num, | |||
2761 | btrfsic_submit_bio(bio); | 2764 | btrfsic_submit_bio(bio); |
2762 | 2765 | ||
2763 | bio_put(bio); | 2766 | bio_put(bio); |
2764 | return ret; | 2767 | return blk_status_to_errno(ret); |
2765 | } | 2768 | } |
2766 | 2769 | ||
2767 | static int merge_bio(struct extent_io_tree *tree, struct page *page, | 2770 | static int merge_bio(struct extent_io_tree *tree, struct page *page, |
@@ -3707,7 +3710,7 @@ static void end_bio_extent_buffer_writepage(struct bio *bio) | |||
3707 | BUG_ON(!eb); | 3710 | BUG_ON(!eb); |
3708 | done = atomic_dec_and_test(&eb->io_pages); | 3711 | done = atomic_dec_and_test(&eb->io_pages); |
3709 | 3712 | ||
3710 | if (bio->bi_error || | 3713 | if (bio->bi_status || |
3711 | test_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags)) { | 3714 | test_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags)) { |
3712 | ClearPageUptodate(page); | 3715 | ClearPageUptodate(page); |
3713 | set_btree_ioerr(page); | 3716 | set_btree_ioerr(page); |