diff options
author | Jeff Mahoney <jeffm@suse.com> | 2011-10-03 23:23:14 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2012-03-21 20:45:34 -0400 |
commit | 355808c296c6923db6705f43639969a80b16d15d (patch) | |
tree | c8f7e1877935fcbfdb0937fea7cd2b29dc474f71 /fs | |
parent | 3444a97255de907f32562741fb6d104620b9fce3 (diff) |
btrfs: ->submit_bio_hook error push-up
This pushes failures from the submit_bio_hook callbacks,
btrfs_submit_bio_hook and btree_submit_bio_hook into the callers, including
callers of submit_one_bio where it catches the failures with BUG_ON.
It also pushes up through the ->readpage_io_failed_hook to
end_bio_extent_writepage where the error is already caught with BUG_ON.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 6 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 37 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 3 |
3 files changed, 31 insertions, 15 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 155c4e35e536..2e4428bd60ec 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -847,9 +847,9 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
847 | { | 847 | { |
848 | int ret; | 848 | int ret; |
849 | 849 | ||
850 | ret = btrfs_bio_wq_end_io(BTRFS_I(inode)->root->fs_info, | 850 | ret = btrfs_bio_wq_end_io(BTRFS_I(inode)->root->fs_info, bio, 1); |
851 | bio, 1); | 851 | if (ret) |
852 | BUG_ON(ret); | 852 | return ret; |
853 | 853 | ||
854 | if (!(rw & REQ_WRITE)) { | 854 | if (!(rw & REQ_WRITE)) { |
855 | /* | 855 | /* |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index c342e923ea41..8368baa1f372 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2199,6 +2199,7 @@ int end_extent_writepage(struct page *page, int err, u64 start, u64 end) | |||
2199 | /* Writeback already completed */ | 2199 | /* Writeback already completed */ |
2200 | if (ret == 0) | 2200 | if (ret == 0) |
2201 | return 1; | 2201 | return 1; |
2202 | BUG_ON(ret < 0); | ||
2202 | } | 2203 | } |
2203 | 2204 | ||
2204 | if (!uptodate) { | 2205 | if (!uptodate) { |
@@ -2351,6 +2352,7 @@ error_handled: | |||
2351 | if (ret == 0) | 2352 | if (ret == 0) |
2352 | goto error_handled; | 2353 | goto error_handled; |
2353 | } | 2354 | } |
2355 | BUG_ON(ret < 0); | ||
2354 | } | 2356 | } |
2355 | 2357 | ||
2356 | if (uptodate) { | 2358 | if (uptodate) { |
@@ -2402,8 +2404,8 @@ btrfs_bio_alloc(struct block_device *bdev, u64 first_sector, int nr_vecs, | |||
2402 | return bio; | 2404 | return bio; |
2403 | } | 2405 | } |
2404 | 2406 | ||
2405 | static int submit_one_bio(int rw, struct bio *bio, int mirror_num, | 2407 | static int __must_check submit_one_bio(int rw, struct bio *bio, |
2406 | unsigned long bio_flags) | 2408 | int mirror_num, unsigned long bio_flags) |
2407 | { | 2409 | { |
2408 | int ret = 0; | 2410 | int ret = 0; |
2409 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | 2411 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; |
@@ -2474,6 +2476,7 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree, | |||
2474 | bio_add_page(bio, page, page_size, offset) < page_size) { | 2476 | bio_add_page(bio, page, page_size, offset) < page_size) { |
2475 | ret = submit_one_bio(rw, bio, mirror_num, | 2477 | ret = submit_one_bio(rw, bio, mirror_num, |
2476 | prev_bio_flags); | 2478 | prev_bio_flags); |
2479 | BUG_ON(ret < 0); | ||
2477 | bio = NULL; | 2480 | bio = NULL; |
2478 | } else { | 2481 | } else { |
2479 | return 0; | 2482 | return 0; |
@@ -2494,8 +2497,10 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree, | |||
2494 | 2497 | ||
2495 | if (bio_ret) | 2498 | if (bio_ret) |
2496 | *bio_ret = bio; | 2499 | *bio_ret = bio; |
2497 | else | 2500 | else { |
2498 | ret = submit_one_bio(rw, bio, mirror_num, bio_flags); | 2501 | ret = submit_one_bio(rw, bio, mirror_num, bio_flags); |
2502 | BUG_ON(ret < 0); | ||
2503 | } | ||
2499 | 2504 | ||
2500 | return ret; | 2505 | return ret; |
2501 | } | 2506 | } |
@@ -2707,8 +2712,10 @@ int extent_read_full_page(struct extent_io_tree *tree, struct page *page, | |||
2707 | 2712 | ||
2708 | ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num, | 2713 | ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num, |
2709 | &bio_flags); | 2714 | &bio_flags); |
2710 | if (bio) | 2715 | if (bio) { |
2711 | ret = submit_one_bio(READ, bio, mirror_num, bio_flags); | 2716 | ret = submit_one_bio(READ, bio, mirror_num, bio_flags); |
2717 | BUG_ON(ret < 0); | ||
2718 | } | ||
2712 | return ret; | 2719 | return ret; |
2713 | } | 2720 | } |
2714 | 2721 | ||
@@ -3126,10 +3133,14 @@ retry: | |||
3126 | static void flush_epd_write_bio(struct extent_page_data *epd) | 3133 | static void flush_epd_write_bio(struct extent_page_data *epd) |
3127 | { | 3134 | { |
3128 | if (epd->bio) { | 3135 | if (epd->bio) { |
3136 | int rw = WRITE; | ||
3137 | int ret; | ||
3138 | |||
3129 | if (epd->sync_io) | 3139 | if (epd->sync_io) |
3130 | submit_one_bio(WRITE_SYNC, epd->bio, 0, 0); | 3140 | rw = WRITE_SYNC; |
3131 | else | 3141 | |
3132 | submit_one_bio(WRITE, epd->bio, 0, 0); | 3142 | ret = submit_one_bio(rw, epd->bio, 0, 0); |
3143 | BUG_ON(ret < 0); | ||
3133 | epd->bio = NULL; | 3144 | epd->bio = NULL; |
3134 | } | 3145 | } |
3135 | } | 3146 | } |
@@ -3245,8 +3256,10 @@ int extent_readpages(struct extent_io_tree *tree, | |||
3245 | page_cache_release(page); | 3256 | page_cache_release(page); |
3246 | } | 3257 | } |
3247 | BUG_ON(!list_empty(pages)); | 3258 | BUG_ON(!list_empty(pages)); |
3248 | if (bio) | 3259 | if (bio) { |
3249 | submit_one_bio(READ, bio, 0, bio_flags); | 3260 | int ret = submit_one_bio(READ, bio, 0, bio_flags); |
3261 | BUG_ON(ret < 0); | ||
3262 | } | ||
3250 | return 0; | 3263 | return 0; |
3251 | } | 3264 | } |
3252 | 3265 | ||
@@ -4075,8 +4088,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
4075 | } | 4088 | } |
4076 | } | 4089 | } |
4077 | 4090 | ||
4078 | if (bio) | 4091 | if (bio) { |
4079 | submit_one_bio(READ, bio, mirror_num, bio_flags); | 4092 | err = submit_one_bio(READ, bio, mirror_num, bio_flags); |
4093 | BUG_ON(err < 0); | ||
4094 | } | ||
4080 | 4095 | ||
4081 | if (ret || wait != WAIT_COMPLETE) | 4096 | if (ret || wait != WAIT_COMPLETE) |
4082 | return ret; | 4097 | return ret; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ad1e88d25031..5394bdb314ca 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1488,7 +1488,8 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
1488 | metadata = 2; | 1488 | metadata = 2; |
1489 | 1489 | ||
1490 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, metadata); | 1490 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, metadata); |
1491 | BUG_ON(ret); | 1491 | if (ret) |
1492 | return ret; | ||
1492 | 1493 | ||
1493 | if (!(rw & REQ_WRITE)) { | 1494 | if (!(rw & REQ_WRITE)) { |
1494 | if (bio_flags & EXTENT_BIO_COMPRESSED) { | 1495 | if (bio_flags & EXTENT_BIO_COMPRESSED) { |