diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 3 | ||||
-rw-r--r-- | fs/btrfs/check-integrity.c | 4 | ||||
-rw-r--r-- | fs/btrfs/compression.c | 44 | ||||
-rw-r--r-- | fs/btrfs/compression.h | 4 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 6 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 75 | ||||
-rw-r--r-- | fs/btrfs/disk-io.h | 12 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 23 | ||||
-rw-r--r-- | fs/btrfs/extent_io.h | 6 | ||||
-rw-r--r-- | fs/btrfs/file-item.c | 14 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 73 | ||||
-rw-r--r-- | fs/btrfs/raid56.c | 16 | ||||
-rw-r--r-- | fs/btrfs/scrub.c | 26 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 11 |
14 files changed, 160 insertions, 157 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index b8622e4d1744..d87ac27a5f2b 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -310,7 +310,8 @@ struct btrfs_dio_private { | |||
310 | * The original bio may be split to several sub-bios, this is | 310 | * The original bio may be split to several sub-bios, this is |
311 | * done during endio of sub-bios | 311 | * done during endio of sub-bios |
312 | */ | 312 | */ |
313 | int (*subio_endio)(struct inode *, struct btrfs_io_bio *, int); | 313 | blk_status_t (*subio_endio)(struct inode *, struct btrfs_io_bio *, |
314 | blk_status_t); | ||
314 | }; | 315 | }; |
315 | 316 | ||
316 | /* | 317 | /* |
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index ab14c2e635ca..4ded1c3f92b8 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
@@ -2129,7 +2129,7 @@ static void btrfsic_bio_end_io(struct bio *bp) | |||
2129 | /* mutex is not held! This is not save if IO is not yet completed | 2129 | /* mutex is not held! This is not save if IO is not yet completed |
2130 | * on umount */ | 2130 | * on umount */ |
2131 | iodone_w_error = 0; | 2131 | iodone_w_error = 0; |
2132 | if (bp->bi_error) | 2132 | if (bp->bi_status) |
2133 | iodone_w_error = 1; | 2133 | iodone_w_error = 1; |
2134 | 2134 | ||
2135 | BUG_ON(NULL == block); | 2135 | BUG_ON(NULL == block); |
@@ -2143,7 +2143,7 @@ static void btrfsic_bio_end_io(struct bio *bp) | |||
2143 | if ((dev_state->state->print_mask & | 2143 | if ((dev_state->state->print_mask & |
2144 | BTRFSIC_PRINT_MASK_END_IO_BIO_BH)) | 2144 | BTRFSIC_PRINT_MASK_END_IO_BIO_BH)) |
2145 | pr_info("bio_end_io(err=%d) for %c @%llu (%s/%llu/%d)\n", | 2145 | pr_info("bio_end_io(err=%d) for %c @%llu (%s/%llu/%d)\n", |
2146 | bp->bi_error, | 2146 | bp->bi_status, |
2147 | btrfsic_get_block_type(dev_state->state, block), | 2147 | btrfsic_get_block_type(dev_state->state, block), |
2148 | block->logical_bytenr, dev_state->name, | 2148 | block->logical_bytenr, dev_state->name, |
2149 | block->dev_bytenr, block->mirror_num); | 2149 | block->dev_bytenr, block->mirror_num); |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 10e6b282d09d..9ac55b266e78 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -155,7 +155,7 @@ static void end_compressed_bio_read(struct bio *bio) | |||
155 | unsigned long index; | 155 | unsigned long index; |
156 | int ret; | 156 | int ret; |
157 | 157 | ||
158 | if (bio->bi_error) | 158 | if (bio->bi_status) |
159 | cb->errors = 1; | 159 | cb->errors = 1; |
160 | 160 | ||
161 | /* if there are more bios still pending for this compressed | 161 | /* if there are more bios still pending for this compressed |
@@ -268,7 +268,7 @@ static void end_compressed_bio_write(struct bio *bio) | |||
268 | struct page *page; | 268 | struct page *page; |
269 | unsigned long index; | 269 | unsigned long index; |
270 | 270 | ||
271 | if (bio->bi_error) | 271 | if (bio->bi_status) |
272 | cb->errors = 1; | 272 | cb->errors = 1; |
273 | 273 | ||
274 | /* if there are more bios still pending for this compressed | 274 | /* if there are more bios still pending for this compressed |
@@ -287,7 +287,7 @@ static void end_compressed_bio_write(struct bio *bio) | |||
287 | cb->start, | 287 | cb->start, |
288 | cb->start + cb->len - 1, | 288 | cb->start + cb->len - 1, |
289 | NULL, | 289 | NULL, |
290 | bio->bi_error ? 0 : 1); | 290 | bio->bi_status ? 0 : 1); |
291 | cb->compressed_pages[0]->mapping = NULL; | 291 | cb->compressed_pages[0]->mapping = NULL; |
292 | 292 | ||
293 | end_compressed_writeback(inode, cb); | 293 | end_compressed_writeback(inode, cb); |
@@ -320,7 +320,7 @@ out: | |||
320 | * This also checksums the file bytes and gets things ready for | 320 | * This also checksums the file bytes and gets things ready for |
321 | * the end io hooks. | 321 | * the end io hooks. |
322 | */ | 322 | */ |
323 | int btrfs_submit_compressed_write(struct inode *inode, u64 start, | 323 | blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start, |
324 | unsigned long len, u64 disk_start, | 324 | unsigned long len, u64 disk_start, |
325 | unsigned long compressed_len, | 325 | unsigned long compressed_len, |
326 | struct page **compressed_pages, | 326 | struct page **compressed_pages, |
@@ -335,13 +335,13 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
335 | struct page *page; | 335 | struct page *page; |
336 | u64 first_byte = disk_start; | 336 | u64 first_byte = disk_start; |
337 | struct block_device *bdev; | 337 | struct block_device *bdev; |
338 | int ret; | 338 | blk_status_t ret; |
339 | int skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; | 339 | int skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; |
340 | 340 | ||
341 | WARN_ON(start & ((u64)PAGE_SIZE - 1)); | 341 | WARN_ON(start & ((u64)PAGE_SIZE - 1)); |
342 | cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS); | 342 | cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS); |
343 | if (!cb) | 343 | if (!cb) |
344 | return -ENOMEM; | 344 | return BLK_STS_RESOURCE; |
345 | refcount_set(&cb->pending_bios, 0); | 345 | refcount_set(&cb->pending_bios, 0); |
346 | cb->errors = 0; | 346 | cb->errors = 0; |
347 | cb->inode = inode; | 347 | cb->inode = inode; |
@@ -358,7 +358,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
358 | bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS); | 358 | bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS); |
359 | if (!bio) { | 359 | if (!bio) { |
360 | kfree(cb); | 360 | kfree(cb); |
361 | return -ENOMEM; | 361 | return BLK_STS_RESOURCE; |
362 | } | 362 | } |
363 | bio_set_op_attrs(bio, REQ_OP_WRITE, 0); | 363 | bio_set_op_attrs(bio, REQ_OP_WRITE, 0); |
364 | bio->bi_private = cb; | 364 | bio->bi_private = cb; |
@@ -368,17 +368,17 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
368 | /* create and submit bios for the compressed pages */ | 368 | /* create and submit bios for the compressed pages */ |
369 | bytes_left = compressed_len; | 369 | bytes_left = compressed_len; |
370 | for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) { | 370 | for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) { |
371 | int submit = 0; | ||
372 | |||
371 | page = compressed_pages[pg_index]; | 373 | page = compressed_pages[pg_index]; |
372 | page->mapping = inode->i_mapping; | 374 | page->mapping = inode->i_mapping; |
373 | if (bio->bi_iter.bi_size) | 375 | if (bio->bi_iter.bi_size) |
374 | ret = io_tree->ops->merge_bio_hook(page, 0, | 376 | submit = io_tree->ops->merge_bio_hook(page, 0, |
375 | PAGE_SIZE, | 377 | PAGE_SIZE, |
376 | bio, 0); | 378 | bio, 0); |
377 | else | ||
378 | ret = 0; | ||
379 | 379 | ||
380 | page->mapping = NULL; | 380 | page->mapping = NULL; |
381 | if (ret || bio_add_page(bio, page, PAGE_SIZE, 0) < | 381 | if (submit || bio_add_page(bio, page, PAGE_SIZE, 0) < |
382 | PAGE_SIZE) { | 382 | PAGE_SIZE) { |
383 | bio_get(bio); | 383 | bio_get(bio); |
384 | 384 | ||
@@ -400,7 +400,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
400 | 400 | ||
401 | ret = btrfs_map_bio(fs_info, bio, 0, 1); | 401 | ret = btrfs_map_bio(fs_info, bio, 0, 1); |
402 | if (ret) { | 402 | if (ret) { |
403 | bio->bi_error = ret; | 403 | bio->bi_status = ret; |
404 | bio_endio(bio); | 404 | bio_endio(bio); |
405 | } | 405 | } |
406 | 406 | ||
@@ -434,7 +434,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
434 | 434 | ||
435 | ret = btrfs_map_bio(fs_info, bio, 0, 1); | 435 | ret = btrfs_map_bio(fs_info, bio, 0, 1); |
436 | if (ret) { | 436 | if (ret) { |
437 | bio->bi_error = ret; | 437 | bio->bi_status = ret; |
438 | bio_endio(bio); | 438 | bio_endio(bio); |
439 | } | 439 | } |
440 | 440 | ||
@@ -569,7 +569,7 @@ next: | |||
569 | * After the compressed pages are read, we copy the bytes into the | 569 | * After the compressed pages are read, we copy the bytes into the |
570 | * bio we were passed and then call the bio end_io calls | 570 | * bio we were passed and then call the bio end_io calls |
571 | */ | 571 | */ |
572 | int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | 572 | blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, |
573 | int mirror_num, unsigned long bio_flags) | 573 | int mirror_num, unsigned long bio_flags) |
574 | { | 574 | { |
575 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 575 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
@@ -586,7 +586,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
586 | u64 em_len; | 586 | u64 em_len; |
587 | u64 em_start; | 587 | u64 em_start; |
588 | struct extent_map *em; | 588 | struct extent_map *em; |
589 | int ret = -ENOMEM; | 589 | blk_status_t ret = BLK_STS_RESOURCE; |
590 | int faili = 0; | 590 | int faili = 0; |
591 | u32 *sums; | 591 | u32 *sums; |
592 | 592 | ||
@@ -600,7 +600,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
600 | PAGE_SIZE); | 600 | PAGE_SIZE); |
601 | read_unlock(&em_tree->lock); | 601 | read_unlock(&em_tree->lock); |
602 | if (!em) | 602 | if (!em) |
603 | return -EIO; | 603 | return BLK_STS_IOERR; |
604 | 604 | ||
605 | compressed_len = em->block_len; | 605 | compressed_len = em->block_len; |
606 | cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS); | 606 | cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS); |
@@ -659,19 +659,19 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
659 | refcount_set(&cb->pending_bios, 1); | 659 | refcount_set(&cb->pending_bios, 1); |
660 | 660 | ||
661 | for (pg_index = 0; pg_index < nr_pages; pg_index++) { | 661 | for (pg_index = 0; pg_index < nr_pages; pg_index++) { |
662 | int submit = 0; | ||
663 | |||
662 | page = cb->compressed_pages[pg_index]; | 664 | page = cb->compressed_pages[pg_index]; |
663 | page->mapping = inode->i_mapping; | 665 | page->mapping = inode->i_mapping; |
664 | page->index = em_start >> PAGE_SHIFT; | 666 | page->index = em_start >> PAGE_SHIFT; |
665 | 667 | ||
666 | if (comp_bio->bi_iter.bi_size) | 668 | if (comp_bio->bi_iter.bi_size) |
667 | ret = tree->ops->merge_bio_hook(page, 0, | 669 | submit = tree->ops->merge_bio_hook(page, 0, |
668 | PAGE_SIZE, | 670 | PAGE_SIZE, |
669 | comp_bio, 0); | 671 | comp_bio, 0); |
670 | else | ||
671 | ret = 0; | ||
672 | 672 | ||
673 | page->mapping = NULL; | 673 | page->mapping = NULL; |
674 | if (ret || bio_add_page(comp_bio, page, PAGE_SIZE, 0) < | 674 | if (submit || bio_add_page(comp_bio, page, PAGE_SIZE, 0) < |
675 | PAGE_SIZE) { | 675 | PAGE_SIZE) { |
676 | bio_get(comp_bio); | 676 | bio_get(comp_bio); |
677 | 677 | ||
@@ -697,7 +697,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
697 | 697 | ||
698 | ret = btrfs_map_bio(fs_info, comp_bio, mirror_num, 0); | 698 | ret = btrfs_map_bio(fs_info, comp_bio, mirror_num, 0); |
699 | if (ret) { | 699 | if (ret) { |
700 | comp_bio->bi_error = ret; | 700 | comp_bio->bi_status = ret; |
701 | bio_endio(comp_bio); | 701 | bio_endio(comp_bio); |
702 | } | 702 | } |
703 | 703 | ||
@@ -726,7 +726,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
726 | 726 | ||
727 | ret = btrfs_map_bio(fs_info, comp_bio, mirror_num, 0); | 727 | ret = btrfs_map_bio(fs_info, comp_bio, mirror_num, 0); |
728 | if (ret) { | 728 | if (ret) { |
729 | comp_bio->bi_error = ret; | 729 | comp_bio->bi_status = ret; |
730 | bio_endio(comp_bio); | 730 | bio_endio(comp_bio); |
731 | } | 731 | } |
732 | 732 | ||
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 39ec43ab8df1..680d4265d601 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h | |||
@@ -48,12 +48,12 @@ int btrfs_decompress_buf2page(const char *buf, unsigned long buf_start, | |||
48 | unsigned long total_out, u64 disk_start, | 48 | unsigned long total_out, u64 disk_start, |
49 | struct bio *bio); | 49 | struct bio *bio); |
50 | 50 | ||
51 | int btrfs_submit_compressed_write(struct inode *inode, u64 start, | 51 | blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start, |
52 | unsigned long len, u64 disk_start, | 52 | unsigned long len, u64 disk_start, |
53 | unsigned long compressed_len, | 53 | unsigned long compressed_len, |
54 | struct page **compressed_pages, | 54 | struct page **compressed_pages, |
55 | unsigned long nr_pages); | 55 | unsigned long nr_pages); |
56 | int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | 56 | blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, |
57 | int mirror_num, unsigned long bio_flags); | 57 | int mirror_num, unsigned long bio_flags); |
58 | 58 | ||
59 | enum btrfs_compression_type { | 59 | enum btrfs_compression_type { |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 643c70d2b2e6..d2da0a52d560 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3078,8 +3078,8 @@ int btrfs_find_name_in_ext_backref(struct btrfs_path *path, | |||
3078 | struct btrfs_dio_private; | 3078 | struct btrfs_dio_private; |
3079 | int btrfs_del_csums(struct btrfs_trans_handle *trans, | 3079 | int btrfs_del_csums(struct btrfs_trans_handle *trans, |
3080 | struct btrfs_fs_info *fs_info, u64 bytenr, u64 len); | 3080 | struct btrfs_fs_info *fs_info, u64 bytenr, u64 len); |
3081 | int btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u32 *dst); | 3081 | blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u32 *dst); |
3082 | int btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio, | 3082 | blk_status_t btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio, |
3083 | u64 logical_offset); | 3083 | u64 logical_offset); |
3084 | int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, | 3084 | int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, |
3085 | struct btrfs_root *root, | 3085 | struct btrfs_root *root, |
@@ -3094,7 +3094,7 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans, | |||
3094 | int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, | 3094 | int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, |
3095 | struct btrfs_root *root, | 3095 | struct btrfs_root *root, |
3096 | struct btrfs_ordered_sum *sums); | 3096 | struct btrfs_ordered_sum *sums); |
3097 | int btrfs_csum_one_bio(struct inode *inode, struct bio *bio, | 3097 | blk_status_t btrfs_csum_one_bio(struct inode *inode, struct bio *bio, |
3098 | u64 file_start, int contig); | 3098 | u64 file_start, int contig); |
3099 | int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, | 3099 | int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, |
3100 | struct list_head *list, int search_commit); | 3100 | struct list_head *list, int search_commit); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8685d67185d0..46accc75ad5a 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -87,7 +87,7 @@ struct btrfs_end_io_wq { | |||
87 | bio_end_io_t *end_io; | 87 | bio_end_io_t *end_io; |
88 | void *private; | 88 | void *private; |
89 | struct btrfs_fs_info *info; | 89 | struct btrfs_fs_info *info; |
90 | int error; | 90 | blk_status_t status; |
91 | enum btrfs_wq_endio_type metadata; | 91 | enum btrfs_wq_endio_type metadata; |
92 | struct list_head list; | 92 | struct list_head list; |
93 | struct btrfs_work work; | 93 | struct btrfs_work work; |
@@ -131,7 +131,7 @@ struct async_submit_bio { | |||
131 | */ | 131 | */ |
132 | u64 bio_offset; | 132 | u64 bio_offset; |
133 | struct btrfs_work work; | 133 | struct btrfs_work work; |
134 | int error; | 134 | blk_status_t status; |
135 | }; | 135 | }; |
136 | 136 | ||
137 | /* | 137 | /* |
@@ -799,7 +799,7 @@ static void end_workqueue_bio(struct bio *bio) | |||
799 | btrfs_work_func_t func; | 799 | btrfs_work_func_t func; |
800 | 800 | ||
801 | fs_info = end_io_wq->info; | 801 | fs_info = end_io_wq->info; |
802 | end_io_wq->error = bio->bi_error; | 802 | end_io_wq->status = bio->bi_status; |
803 | 803 | ||
804 | if (bio_op(bio) == REQ_OP_WRITE) { | 804 | if (bio_op(bio) == REQ_OP_WRITE) { |
805 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) { | 805 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) { |
@@ -836,19 +836,19 @@ static void end_workqueue_bio(struct bio *bio) | |||
836 | btrfs_queue_work(wq, &end_io_wq->work); | 836 | btrfs_queue_work(wq, &end_io_wq->work); |
837 | } | 837 | } |
838 | 838 | ||
839 | int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, | 839 | blk_status_t btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, |
840 | enum btrfs_wq_endio_type metadata) | 840 | enum btrfs_wq_endio_type metadata) |
841 | { | 841 | { |
842 | struct btrfs_end_io_wq *end_io_wq; | 842 | struct btrfs_end_io_wq *end_io_wq; |
843 | 843 | ||
844 | end_io_wq = kmem_cache_alloc(btrfs_end_io_wq_cache, GFP_NOFS); | 844 | end_io_wq = kmem_cache_alloc(btrfs_end_io_wq_cache, GFP_NOFS); |
845 | if (!end_io_wq) | 845 | if (!end_io_wq) |
846 | return -ENOMEM; | 846 | return BLK_STS_RESOURCE; |
847 | 847 | ||
848 | end_io_wq->private = bio->bi_private; | 848 | end_io_wq->private = bio->bi_private; |
849 | end_io_wq->end_io = bio->bi_end_io; | 849 | end_io_wq->end_io = bio->bi_end_io; |
850 | end_io_wq->info = info; | 850 | end_io_wq->info = info; |
851 | end_io_wq->error = 0; | 851 | end_io_wq->status = 0; |
852 | end_io_wq->bio = bio; | 852 | end_io_wq->bio = bio; |
853 | end_io_wq->metadata = metadata; | 853 | end_io_wq->metadata = metadata; |
854 | 854 | ||
@@ -868,14 +868,14 @@ unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info) | |||
868 | static void run_one_async_start(struct btrfs_work *work) | 868 | static void run_one_async_start(struct btrfs_work *work) |
869 | { | 869 | { |
870 | struct async_submit_bio *async; | 870 | struct async_submit_bio *async; |
871 | int ret; | 871 | blk_status_t ret; |
872 | 872 | ||
873 | async = container_of(work, struct async_submit_bio, work); | 873 | async = container_of(work, struct async_submit_bio, work); |
874 | ret = async->submit_bio_start(async->inode, async->bio, | 874 | ret = async->submit_bio_start(async->inode, async->bio, |
875 | async->mirror_num, async->bio_flags, | 875 | async->mirror_num, async->bio_flags, |
876 | async->bio_offset); | 876 | async->bio_offset); |
877 | if (ret) | 877 | if (ret) |
878 | async->error = ret; | 878 | async->status = ret; |
879 | } | 879 | } |
880 | 880 | ||
881 | static void run_one_async_done(struct btrfs_work *work) | 881 | static void run_one_async_done(struct btrfs_work *work) |
@@ -898,8 +898,8 @@ static void run_one_async_done(struct btrfs_work *work) | |||
898 | wake_up(&fs_info->async_submit_wait); | 898 | wake_up(&fs_info->async_submit_wait); |
899 | 899 | ||
900 | /* If an error occurred we just want to clean up the bio and move on */ | 900 | /* If an error occurred we just want to clean up the bio and move on */ |
901 | if (async->error) { | 901 | if (async->status) { |
902 | async->bio->bi_error = async->error; | 902 | async->bio->bi_status = async->status; |
903 | bio_endio(async->bio); | 903 | bio_endio(async->bio); |
904 | return; | 904 | return; |
905 | } | 905 | } |
@@ -916,18 +916,17 @@ static void run_one_async_free(struct btrfs_work *work) | |||
916 | kfree(async); | 916 | kfree(async); |
917 | } | 917 | } |
918 | 918 | ||
919 | int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | 919 | blk_status_t btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, |
920 | struct bio *bio, int mirror_num, | 920 | struct inode *inode, struct bio *bio, int mirror_num, |
921 | unsigned long bio_flags, | 921 | unsigned long bio_flags, u64 bio_offset, |
922 | u64 bio_offset, | 922 | extent_submit_bio_hook_t *submit_bio_start, |
923 | extent_submit_bio_hook_t *submit_bio_start, | 923 | extent_submit_bio_hook_t *submit_bio_done) |
924 | extent_submit_bio_hook_t *submit_bio_done) | ||
925 | { | 924 | { |
926 | struct async_submit_bio *async; | 925 | struct async_submit_bio *async; |
927 | 926 | ||
928 | async = kmalloc(sizeof(*async), GFP_NOFS); | 927 | async = kmalloc(sizeof(*async), GFP_NOFS); |
929 | if (!async) | 928 | if (!async) |
930 | return -ENOMEM; | 929 | return BLK_STS_RESOURCE; |
931 | 930 | ||
932 | async->inode = inode; | 931 | async->inode = inode; |
933 | async->bio = bio; | 932 | async->bio = bio; |
@@ -941,7 +940,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | |||
941 | async->bio_flags = bio_flags; | 940 | async->bio_flags = bio_flags; |
942 | async->bio_offset = bio_offset; | 941 | async->bio_offset = bio_offset; |
943 | 942 | ||
944 | async->error = 0; | 943 | async->status = 0; |
945 | 944 | ||
946 | atomic_inc(&fs_info->nr_async_submits); | 945 | atomic_inc(&fs_info->nr_async_submits); |
947 | 946 | ||
@@ -959,7 +958,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | |||
959 | return 0; | 958 | return 0; |
960 | } | 959 | } |
961 | 960 | ||
962 | static int btree_csum_one_bio(struct bio *bio) | 961 | static blk_status_t btree_csum_one_bio(struct bio *bio) |
963 | { | 962 | { |
964 | struct bio_vec *bvec; | 963 | struct bio_vec *bvec; |
965 | struct btrfs_root *root; | 964 | struct btrfs_root *root; |
@@ -972,12 +971,12 @@ static int btree_csum_one_bio(struct bio *bio) | |||
972 | break; | 971 | break; |
973 | } | 972 | } |
974 | 973 | ||
975 | return ret; | 974 | return errno_to_blk_status(ret); |
976 | } | 975 | } |
977 | 976 | ||
978 | static int __btree_submit_bio_start(struct inode *inode, struct bio *bio, | 977 | static blk_status_t __btree_submit_bio_start(struct inode *inode, |
979 | int mirror_num, unsigned long bio_flags, | 978 | struct bio *bio, int mirror_num, unsigned long bio_flags, |
980 | u64 bio_offset) | 979 | u64 bio_offset) |
981 | { | 980 | { |
982 | /* | 981 | /* |
983 | * when we're called for a write, we're already in the async | 982 | * when we're called for a write, we're already in the async |
@@ -986,11 +985,11 @@ static int __btree_submit_bio_start(struct inode *inode, struct bio *bio, | |||
986 | return btree_csum_one_bio(bio); | 985 | return btree_csum_one_bio(bio); |
987 | } | 986 | } |
988 | 987 | ||
989 | static int __btree_submit_bio_done(struct inode *inode, struct bio *bio, | 988 | static blk_status_t __btree_submit_bio_done(struct inode *inode, |
990 | int mirror_num, unsigned long bio_flags, | 989 | struct bio *bio, int mirror_num, unsigned long bio_flags, |
991 | u64 bio_offset) | 990 | u64 bio_offset) |
992 | { | 991 | { |
993 | int ret; | 992 | blk_status_t ret; |
994 | 993 | ||
995 | /* | 994 | /* |
996 | * when we're called for a write, we're already in the async | 995 | * when we're called for a write, we're already in the async |
@@ -998,7 +997,7 @@ static int __btree_submit_bio_done(struct inode *inode, struct bio *bio, | |||
998 | */ | 997 | */ |
999 | ret = btrfs_map_bio(btrfs_sb(inode->i_sb), bio, mirror_num, 1); | 998 | ret = btrfs_map_bio(btrfs_sb(inode->i_sb), bio, mirror_num, 1); |
1000 | if (ret) { | 999 | if (ret) { |
1001 | bio->bi_error = ret; | 1000 | bio->bi_status = ret; |
1002 | bio_endio(bio); | 1001 | bio_endio(bio); |
1003 | } | 1002 | } |
1004 | return ret; | 1003 | return ret; |
@@ -1015,13 +1014,13 @@ static int check_async_write(unsigned long bio_flags) | |||
1015 | return 1; | 1014 | return 1; |
1016 | } | 1015 | } |
1017 | 1016 | ||
1018 | static int btree_submit_bio_hook(struct inode *inode, struct bio *bio, | 1017 | static blk_status_t btree_submit_bio_hook(struct inode *inode, struct bio *bio, |
1019 | int mirror_num, unsigned long bio_flags, | 1018 | int mirror_num, unsigned long bio_flags, |
1020 | u64 bio_offset) | 1019 | u64 bio_offset) |
1021 | { | 1020 | { |
1022 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 1021 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
1023 | int async = check_async_write(bio_flags); | 1022 | int async = check_async_write(bio_flags); |
1024 | int ret; | 1023 | blk_status_t ret; |
1025 | 1024 | ||
1026 | if (bio_op(bio) != REQ_OP_WRITE) { | 1025 | if (bio_op(bio) != REQ_OP_WRITE) { |
1027 | /* | 1026 | /* |
@@ -1054,7 +1053,7 @@ static int btree_submit_bio_hook(struct inode *inode, struct bio *bio, | |||
1054 | return 0; | 1053 | return 0; |
1055 | 1054 | ||
1056 | out_w_error: | 1055 | out_w_error: |
1057 | bio->bi_error = ret; | 1056 | bio->bi_status = ret; |
1058 | bio_endio(bio); | 1057 | bio_endio(bio); |
1059 | return ret; | 1058 | return ret; |
1060 | } | 1059 | } |
@@ -1820,7 +1819,7 @@ static void end_workqueue_fn(struct btrfs_work *work) | |||
1820 | end_io_wq = container_of(work, struct btrfs_end_io_wq, work); | 1819 | end_io_wq = container_of(work, struct btrfs_end_io_wq, work); |
1821 | bio = end_io_wq->bio; | 1820 | bio = end_io_wq->bio; |
1822 | 1821 | ||
1823 | bio->bi_error = end_io_wq->error; | 1822 | bio->bi_status = end_io_wq->status; |
1824 | bio->bi_private = end_io_wq->private; | 1823 | bio->bi_private = end_io_wq->private; |
1825 | bio->bi_end_io = end_io_wq->end_io; | 1824 | bio->bi_end_io = end_io_wq->end_io; |
1826 | kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); | 1825 | kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); |
@@ -3495,11 +3494,11 @@ static void btrfs_end_empty_barrier(struct bio *bio) | |||
3495 | * any device where the flush fails with eopnotsupp are flagged as not-barrier | 3494 | * any device where the flush fails with eopnotsupp are flagged as not-barrier |
3496 | * capable | 3495 | * capable |
3497 | */ | 3496 | */ |
3498 | static int write_dev_flush(struct btrfs_device *device, int wait) | 3497 | static blk_status_t write_dev_flush(struct btrfs_device *device, int wait) |
3499 | { | 3498 | { |
3500 | struct request_queue *q = bdev_get_queue(device->bdev); | 3499 | struct request_queue *q = bdev_get_queue(device->bdev); |
3501 | struct bio *bio; | 3500 | struct bio *bio; |
3502 | int ret = 0; | 3501 | blk_status_t ret = 0; |
3503 | 3502 | ||
3504 | if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags)) | 3503 | if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags)) |
3505 | return 0; | 3504 | return 0; |
@@ -3511,8 +3510,8 @@ static int write_dev_flush(struct btrfs_device *device, int wait) | |||
3511 | 3510 | ||
3512 | wait_for_completion(&device->flush_wait); | 3511 | wait_for_completion(&device->flush_wait); |
3513 | 3512 | ||
3514 | if (bio->bi_error) { | 3513 | if (bio->bi_status) { |
3515 | ret = bio->bi_error; | 3514 | ret = bio->bi_status; |
3516 | btrfs_dev_stat_inc_and_print(device, | 3515 | btrfs_dev_stat_inc_and_print(device, |
3517 | BTRFS_DEV_STAT_FLUSH_ERRS); | 3516 | BTRFS_DEV_STAT_FLUSH_ERRS); |
3518 | } | 3517 | } |
@@ -3531,7 +3530,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait) | |||
3531 | device->flush_bio = NULL; | 3530 | device->flush_bio = NULL; |
3532 | bio = btrfs_io_bio_alloc(GFP_NOFS, 0); | 3531 | bio = btrfs_io_bio_alloc(GFP_NOFS, 0); |
3533 | if (!bio) | 3532 | if (!bio) |
3534 | return -ENOMEM; | 3533 | return BLK_STS_RESOURCE; |
3535 | 3534 | ||
3536 | bio->bi_end_io = btrfs_end_empty_barrier; | 3535 | bio->bi_end_io = btrfs_end_empty_barrier; |
3537 | bio->bi_bdev = device->bdev; | 3536 | bio->bi_bdev = device->bdev; |
@@ -3556,7 +3555,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info) | |||
3556 | struct btrfs_device *dev; | 3555 | struct btrfs_device *dev; |
3557 | int errors_send = 0; | 3556 | int errors_send = 0; |
3558 | int errors_wait = 0; | 3557 | int errors_wait = 0; |
3559 | int ret; | 3558 | blk_status_t ret; |
3560 | 3559 | ||
3561 | /* send down all the barriers */ | 3560 | /* send down all the barriers */ |
3562 | head = &info->fs_devices->devices; | 3561 | head = &info->fs_devices->devices; |
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index 21f1ceb85b76..c581927555f3 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -118,13 +118,13 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, | |||
118 | int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); | 118 | int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); |
119 | u32 btrfs_csum_data(const char *data, u32 seed, size_t len); | 119 | u32 btrfs_csum_data(const char *data, u32 seed, size_t len); |
120 | void btrfs_csum_final(u32 crc, u8 *result); | 120 | void btrfs_csum_final(u32 crc, u8 *result); |
121 | int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, | 121 | blk_status_t btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, |
122 | enum btrfs_wq_endio_type metadata); | 122 | enum btrfs_wq_endio_type metadata); |
123 | int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | 123 | blk_status_t btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, |
124 | struct bio *bio, int mirror_num, | 124 | struct inode *inode, struct bio *bio, int mirror_num, |
125 | unsigned long bio_flags, u64 bio_offset, | 125 | unsigned long bio_flags, u64 bio_offset, |
126 | extent_submit_bio_hook_t *submit_bio_start, | 126 | extent_submit_bio_hook_t *submit_bio_start, |
127 | extent_submit_bio_hook_t *submit_bio_done); | 127 | extent_submit_bio_hook_t *submit_bio_done); |
128 | unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info); | 128 | unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info); |
129 | int btrfs_write_tree_block(struct extent_buffer *buf); | 129 | int btrfs_write_tree_block(struct extent_buffer *buf); |
130 | int btrfs_wait_tree_block_writeback(struct extent_buffer *buf); | 130 | int btrfs_wait_tree_block_writeback(struct extent_buffer *buf); |
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); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 1eafa2f0ede3..487ca0207cb6 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -92,9 +92,9 @@ struct btrfs_inode; | |||
92 | struct btrfs_io_bio; | 92 | struct btrfs_io_bio; |
93 | struct io_failure_record; | 93 | struct io_failure_record; |
94 | 94 | ||
95 | typedef int (extent_submit_bio_hook_t)(struct inode *inode, struct bio *bio, | 95 | typedef blk_status_t (extent_submit_bio_hook_t)(struct inode *inode, |
96 | int mirror_num, unsigned long bio_flags, | 96 | struct bio *bio, int mirror_num, unsigned long bio_flags, |
97 | u64 bio_offset); | 97 | u64 bio_offset); |
98 | struct extent_io_ops { | 98 | struct extent_io_ops { |
99 | /* | 99 | /* |
100 | * The following callbacks must be allways defined, the function | 100 | * The following callbacks must be allways defined, the function |
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 64fcb31d7163..5b1c7090e546 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -160,7 +160,7 @@ static void btrfs_io_bio_endio_readpage(struct btrfs_io_bio *bio, int err) | |||
160 | kfree(bio->csum_allocated); | 160 | kfree(bio->csum_allocated); |
161 | } | 161 | } |
162 | 162 | ||
163 | static int __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, | 163 | static blk_status_t __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, |
164 | u64 logical_offset, u32 *dst, int dio) | 164 | u64 logical_offset, u32 *dst, int dio) |
165 | { | 165 | { |
166 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 166 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
@@ -182,7 +182,7 @@ static int __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, | |||
182 | 182 | ||
183 | path = btrfs_alloc_path(); | 183 | path = btrfs_alloc_path(); |
184 | if (!path) | 184 | if (!path) |
185 | return -ENOMEM; | 185 | return BLK_STS_RESOURCE; |
186 | 186 | ||
187 | nblocks = bio->bi_iter.bi_size >> inode->i_sb->s_blocksize_bits; | 187 | nblocks = bio->bi_iter.bi_size >> inode->i_sb->s_blocksize_bits; |
188 | if (!dst) { | 188 | if (!dst) { |
@@ -191,7 +191,7 @@ static int __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, | |||
191 | csum_size, GFP_NOFS); | 191 | csum_size, GFP_NOFS); |
192 | if (!btrfs_bio->csum_allocated) { | 192 | if (!btrfs_bio->csum_allocated) { |
193 | btrfs_free_path(path); | 193 | btrfs_free_path(path); |
194 | return -ENOMEM; | 194 | return BLK_STS_RESOURCE; |
195 | } | 195 | } |
196 | btrfs_bio->csum = btrfs_bio->csum_allocated; | 196 | btrfs_bio->csum = btrfs_bio->csum_allocated; |
197 | btrfs_bio->end_io = btrfs_io_bio_endio_readpage; | 197 | btrfs_bio->end_io = btrfs_io_bio_endio_readpage; |
@@ -303,12 +303,12 @@ next: | |||
303 | return 0; | 303 | return 0; |
304 | } | 304 | } |
305 | 305 | ||
306 | int btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u32 *dst) | 306 | blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u32 *dst) |
307 | { | 307 | { |
308 | return __btrfs_lookup_bio_sums(inode, bio, 0, dst, 0); | 308 | return __btrfs_lookup_bio_sums(inode, bio, 0, dst, 0); |
309 | } | 309 | } |
310 | 310 | ||
311 | int btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio, u64 offset) | 311 | blk_status_t btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio, u64 offset) |
312 | { | 312 | { |
313 | return __btrfs_lookup_bio_sums(inode, bio, offset, NULL, 1); | 313 | return __btrfs_lookup_bio_sums(inode, bio, offset, NULL, 1); |
314 | } | 314 | } |
@@ -433,7 +433,7 @@ fail: | |||
433 | return ret; | 433 | return ret; |
434 | } | 434 | } |
435 | 435 | ||
436 | int btrfs_csum_one_bio(struct inode *inode, struct bio *bio, | 436 | blk_status_t btrfs_csum_one_bio(struct inode *inode, struct bio *bio, |
437 | u64 file_start, int contig) | 437 | u64 file_start, int contig) |
438 | { | 438 | { |
439 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 439 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
@@ -452,7 +452,7 @@ int btrfs_csum_one_bio(struct inode *inode, struct bio *bio, | |||
452 | sums = kzalloc(btrfs_ordered_sum_size(fs_info, bio->bi_iter.bi_size), | 452 | sums = kzalloc(btrfs_ordered_sum_size(fs_info, bio->bi_iter.bi_size), |
453 | GFP_NOFS); | 453 | GFP_NOFS); |
454 | if (!sums) | 454 | if (!sums) |
455 | return -ENOMEM; | 455 | return BLK_STS_RESOURCE; |
456 | 456 | ||
457 | sums->len = bio->bi_iter.bi_size; | 457 | sums->len = bio->bi_iter.bi_size; |
458 | INIT_LIST_HEAD(&sums->list); | 458 | INIT_LIST_HEAD(&sums->list); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 758b2666885e..ea7cae1003eb 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -842,13 +842,12 @@ retry: | |||
842 | NULL, EXTENT_LOCKED | EXTENT_DELALLOC, | 842 | NULL, EXTENT_LOCKED | EXTENT_DELALLOC, |
843 | PAGE_UNLOCK | PAGE_CLEAR_DIRTY | | 843 | PAGE_UNLOCK | PAGE_CLEAR_DIRTY | |
844 | PAGE_SET_WRITEBACK); | 844 | PAGE_SET_WRITEBACK); |
845 | ret = btrfs_submit_compressed_write(inode, | 845 | if (btrfs_submit_compressed_write(inode, |
846 | async_extent->start, | 846 | async_extent->start, |
847 | async_extent->ram_size, | 847 | async_extent->ram_size, |
848 | ins.objectid, | 848 | ins.objectid, |
849 | ins.offset, async_extent->pages, | 849 | ins.offset, async_extent->pages, |
850 | async_extent->nr_pages); | 850 | async_extent->nr_pages)) { |
851 | if (ret) { | ||
852 | struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; | 851 | struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; |
853 | struct page *p = async_extent->pages[0]; | 852 | struct page *p = async_extent->pages[0]; |
854 | const u64 start = async_extent->start; | 853 | const u64 start = async_extent->start; |
@@ -1901,11 +1900,11 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset, | |||
1901 | * At IO completion time the cums attached on the ordered extent record | 1900 | * At IO completion time the cums attached on the ordered extent record |
1902 | * are inserted into the btree | 1901 | * are inserted into the btree |
1903 | */ | 1902 | */ |
1904 | static int __btrfs_submit_bio_start(struct inode *inode, struct bio *bio, | 1903 | static blk_status_t __btrfs_submit_bio_start(struct inode *inode, |
1905 | int mirror_num, unsigned long bio_flags, | 1904 | struct bio *bio, int mirror_num, unsigned long bio_flags, |
1906 | u64 bio_offset) | 1905 | u64 bio_offset) |
1907 | { | 1906 | { |
1908 | int ret = 0; | 1907 | blk_status_t ret = 0; |
1909 | 1908 | ||
1910 | ret = btrfs_csum_one_bio(inode, bio, 0, 0); | 1909 | ret = btrfs_csum_one_bio(inode, bio, 0, 0); |
1911 | BUG_ON(ret); /* -ENOMEM */ | 1910 | BUG_ON(ret); /* -ENOMEM */ |
@@ -1920,16 +1919,16 @@ static int __btrfs_submit_bio_start(struct inode *inode, struct bio *bio, | |||
1920 | * At IO completion time the cums attached on the ordered extent record | 1919 | * At IO completion time the cums attached on the ordered extent record |
1921 | * are inserted into the btree | 1920 | * are inserted into the btree |
1922 | */ | 1921 | */ |
1923 | static int __btrfs_submit_bio_done(struct inode *inode, struct bio *bio, | 1922 | static blk_status_t __btrfs_submit_bio_done(struct inode *inode, |
1924 | int mirror_num, unsigned long bio_flags, | 1923 | struct bio *bio, int mirror_num, unsigned long bio_flags, |
1925 | u64 bio_offset) | 1924 | u64 bio_offset) |
1926 | { | 1925 | { |
1927 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 1926 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
1928 | int ret; | 1927 | blk_status_t ret; |
1929 | 1928 | ||
1930 | ret = btrfs_map_bio(fs_info, bio, mirror_num, 1); | 1929 | ret = btrfs_map_bio(fs_info, bio, mirror_num, 1); |
1931 | if (ret) { | 1930 | if (ret) { |
1932 | bio->bi_error = ret; | 1931 | bio->bi_status = ret; |
1933 | bio_endio(bio); | 1932 | bio_endio(bio); |
1934 | } | 1933 | } |
1935 | return ret; | 1934 | return ret; |
@@ -1939,14 +1938,14 @@ static int __btrfs_submit_bio_done(struct inode *inode, struct bio *bio, | |||
1939 | * extent_io.c submission hook. This does the right thing for csum calculation | 1938 | * extent_io.c submission hook. This does the right thing for csum calculation |
1940 | * on write, or reading the csums from the tree before a read | 1939 | * on write, or reading the csums from the tree before a read |
1941 | */ | 1940 | */ |
1942 | static int btrfs_submit_bio_hook(struct inode *inode, struct bio *bio, | 1941 | static blk_status_t btrfs_submit_bio_hook(struct inode *inode, struct bio *bio, |
1943 | int mirror_num, unsigned long bio_flags, | 1942 | int mirror_num, unsigned long bio_flags, |
1944 | u64 bio_offset) | 1943 | u64 bio_offset) |
1945 | { | 1944 | { |
1946 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 1945 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
1947 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1946 | struct btrfs_root *root = BTRFS_I(inode)->root; |
1948 | enum btrfs_wq_endio_type metadata = BTRFS_WQ_ENDIO_DATA; | 1947 | enum btrfs_wq_endio_type metadata = BTRFS_WQ_ENDIO_DATA; |
1949 | int ret = 0; | 1948 | blk_status_t ret = 0; |
1950 | int skip_sum; | 1949 | int skip_sum; |
1951 | int async = !atomic_read(&BTRFS_I(inode)->sync_writers); | 1950 | int async = !atomic_read(&BTRFS_I(inode)->sync_writers); |
1952 | 1951 | ||
@@ -1991,8 +1990,8 @@ mapit: | |||
1991 | ret = btrfs_map_bio(fs_info, bio, mirror_num, 0); | 1990 | ret = btrfs_map_bio(fs_info, bio, mirror_num, 0); |
1992 | 1991 | ||
1993 | out: | 1992 | out: |
1994 | if (ret < 0) { | 1993 | if (ret) { |
1995 | bio->bi_error = ret; | 1994 | bio->bi_status = ret; |
1996 | bio_endio(bio); | 1995 | bio_endio(bio); |
1997 | } | 1996 | } |
1998 | return ret; | 1997 | return ret; |
@@ -8037,7 +8036,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio) | |||
8037 | struct bio_vec *bvec; | 8036 | struct bio_vec *bvec; |
8038 | int i; | 8037 | int i; |
8039 | 8038 | ||
8040 | if (bio->bi_error) | 8039 | if (bio->bi_status) |
8041 | goto end; | 8040 | goto end; |
8042 | 8041 | ||
8043 | ASSERT(bio->bi_vcnt == 1); | 8042 | ASSERT(bio->bi_vcnt == 1); |
@@ -8116,7 +8115,7 @@ static void btrfs_retry_endio(struct bio *bio) | |||
8116 | int ret; | 8115 | int ret; |
8117 | int i; | 8116 | int i; |
8118 | 8117 | ||
8119 | if (bio->bi_error) | 8118 | if (bio->bi_status) |
8120 | goto end; | 8119 | goto end; |
8121 | 8120 | ||
8122 | uptodate = 1; | 8121 | uptodate = 1; |
@@ -8141,8 +8140,8 @@ end: | |||
8141 | bio_put(bio); | 8140 | bio_put(bio); |
8142 | } | 8141 | } |
8143 | 8142 | ||
8144 | static int __btrfs_subio_endio_read(struct inode *inode, | 8143 | static blk_status_t __btrfs_subio_endio_read(struct inode *inode, |
8145 | struct btrfs_io_bio *io_bio, int err) | 8144 | struct btrfs_io_bio *io_bio, blk_status_t err) |
8146 | { | 8145 | { |
8147 | struct btrfs_fs_info *fs_info; | 8146 | struct btrfs_fs_info *fs_info; |
8148 | struct bio_vec *bvec; | 8147 | struct bio_vec *bvec; |
@@ -8184,7 +8183,7 @@ try_again: | |||
8184 | io_bio->mirror_num, | 8183 | io_bio->mirror_num, |
8185 | btrfs_retry_endio, &done); | 8184 | btrfs_retry_endio, &done); |
8186 | if (ret) { | 8185 | if (ret) { |
8187 | err = ret; | 8186 | err = errno_to_blk_status(ret); |
8188 | goto next; | 8187 | goto next; |
8189 | } | 8188 | } |
8190 | 8189 | ||
@@ -8211,8 +8210,8 @@ next: | |||
8211 | return err; | 8210 | return err; |
8212 | } | 8211 | } |
8213 | 8212 | ||
8214 | static int btrfs_subio_endio_read(struct inode *inode, | 8213 | static blk_status_t btrfs_subio_endio_read(struct inode *inode, |
8215 | struct btrfs_io_bio *io_bio, int err) | 8214 | struct btrfs_io_bio *io_bio, blk_status_t err) |
8216 | { | 8215 | { |
8217 | bool skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; | 8216 | bool skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; |
8218 | 8217 | ||
@@ -8232,7 +8231,7 @@ static void btrfs_endio_direct_read(struct bio *bio) | |||
8232 | struct inode *inode = dip->inode; | 8231 | struct inode *inode = dip->inode; |
8233 | struct bio *dio_bio; | 8232 | struct bio *dio_bio; |
8234 | struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); | 8233 | struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); |
8235 | int err = bio->bi_error; | 8234 | blk_status_t err = bio->bi_status; |
8236 | 8235 | ||
8237 | if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) | 8236 | if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) |
8238 | err = btrfs_subio_endio_read(inode, io_bio, err); | 8237 | err = btrfs_subio_endio_read(inode, io_bio, err); |
@@ -8243,11 +8242,11 @@ static void btrfs_endio_direct_read(struct bio *bio) | |||
8243 | 8242 | ||
8244 | kfree(dip); | 8243 | kfree(dip); |
8245 | 8244 | ||
8246 | dio_bio->bi_error = bio->bi_error; | 8245 | dio_bio->bi_status = bio->bi_status; |
8247 | dio_end_io(dio_bio); | 8246 | dio_end_io(dio_bio); |
8248 | 8247 | ||
8249 | if (io_bio->end_io) | 8248 | if (io_bio->end_io) |
8250 | io_bio->end_io(io_bio, err); | 8249 | io_bio->end_io(io_bio, blk_status_to_errno(err)); |
8251 | bio_put(bio); | 8250 | bio_put(bio); |
8252 | } | 8251 | } |
8253 | 8252 | ||
@@ -8299,20 +8298,20 @@ static void btrfs_endio_direct_write(struct bio *bio) | |||
8299 | struct bio *dio_bio = dip->dio_bio; | 8298 | struct bio *dio_bio = dip->dio_bio; |
8300 | 8299 | ||
8301 | __endio_write_update_ordered(dip->inode, dip->logical_offset, | 8300 | __endio_write_update_ordered(dip->inode, dip->logical_offset, |
8302 | dip->bytes, !bio->bi_error); | 8301 | dip->bytes, !bio->bi_status); |
8303 | 8302 | ||
8304 | kfree(dip); | 8303 | kfree(dip); |
8305 | 8304 | ||
8306 | dio_bio->bi_error = bio->bi_error; | 8305 | dio_bio->bi_status = bio->bi_status; |
8307 | dio_end_io(dio_bio); | 8306 | dio_end_io(dio_bio); |
8308 | bio_put(bio); | 8307 | bio_put(bio); |
8309 | } | 8308 | } |
8310 | 8309 | ||
8311 | static int __btrfs_submit_bio_start_direct_io(struct inode *inode, | 8310 | static blk_status_t __btrfs_submit_bio_start_direct_io(struct inode *inode, |
8312 | struct bio *bio, int mirror_num, | 8311 | struct bio *bio, int mirror_num, |
8313 | unsigned long bio_flags, u64 offset) | 8312 | unsigned long bio_flags, u64 offset) |
8314 | { | 8313 | { |
8315 | int ret; | 8314 | blk_status_t ret; |
8316 | ret = btrfs_csum_one_bio(inode, bio, offset, 1); | 8315 | ret = btrfs_csum_one_bio(inode, bio, offset, 1); |
8317 | BUG_ON(ret); /* -ENOMEM */ | 8316 | BUG_ON(ret); /* -ENOMEM */ |
8318 | return 0; | 8317 | return 0; |
@@ -8321,7 +8320,7 @@ static int __btrfs_submit_bio_start_direct_io(struct inode *inode, | |||
8321 | static void btrfs_end_dio_bio(struct bio *bio) | 8320 | static void btrfs_end_dio_bio(struct bio *bio) |
8322 | { | 8321 | { |
8323 | struct btrfs_dio_private *dip = bio->bi_private; | 8322 | struct btrfs_dio_private *dip = bio->bi_private; |
8324 | int err = bio->bi_error; | 8323 | blk_status_t err = bio->bi_status; |
8325 | 8324 | ||
8326 | if (err) | 8325 | if (err) |
8327 | btrfs_warn(BTRFS_I(dip->inode)->root->fs_info, | 8326 | btrfs_warn(BTRFS_I(dip->inode)->root->fs_info, |
@@ -8351,7 +8350,7 @@ static void btrfs_end_dio_bio(struct bio *bio) | |||
8351 | if (dip->errors) { | 8350 | if (dip->errors) { |
8352 | bio_io_error(dip->orig_bio); | 8351 | bio_io_error(dip->orig_bio); |
8353 | } else { | 8352 | } else { |
8354 | dip->dio_bio->bi_error = 0; | 8353 | dip->dio_bio->bi_status = 0; |
8355 | bio_endio(dip->orig_bio); | 8354 | bio_endio(dip->orig_bio); |
8356 | } | 8355 | } |
8357 | out: | 8356 | out: |
@@ -8368,14 +8367,14 @@ static struct bio *btrfs_dio_bio_alloc(struct block_device *bdev, | |||
8368 | return bio; | 8367 | return bio; |
8369 | } | 8368 | } |
8370 | 8369 | ||
8371 | static inline int btrfs_lookup_and_bind_dio_csum(struct inode *inode, | 8370 | static inline blk_status_t btrfs_lookup_and_bind_dio_csum(struct inode *inode, |
8372 | struct btrfs_dio_private *dip, | 8371 | struct btrfs_dio_private *dip, |
8373 | struct bio *bio, | 8372 | struct bio *bio, |
8374 | u64 file_offset) | 8373 | u64 file_offset) |
8375 | { | 8374 | { |
8376 | struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); | 8375 | struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); |
8377 | struct btrfs_io_bio *orig_io_bio = btrfs_io_bio(dip->orig_bio); | 8376 | struct btrfs_io_bio *orig_io_bio = btrfs_io_bio(dip->orig_bio); |
8378 | int ret; | 8377 | blk_status_t ret; |
8379 | 8378 | ||
8380 | /* | 8379 | /* |
8381 | * We load all the csum data we need when we submit | 8380 | * We load all the csum data we need when we submit |
@@ -8406,7 +8405,7 @@ static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, | |||
8406 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 8405 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
8407 | struct btrfs_dio_private *dip = bio->bi_private; | 8406 | struct btrfs_dio_private *dip = bio->bi_private; |
8408 | bool write = bio_op(bio) == REQ_OP_WRITE; | 8407 | bool write = bio_op(bio) == REQ_OP_WRITE; |
8409 | int ret; | 8408 | blk_status_t ret; |
8410 | 8409 | ||
8411 | if (async_submit) | 8410 | if (async_submit) |
8412 | async_submit = !atomic_read(&BTRFS_I(inode)->sync_writers); | 8411 | async_submit = !atomic_read(&BTRFS_I(inode)->sync_writers); |
@@ -8649,7 +8648,7 @@ free_ordered: | |||
8649 | * callbacks - they require an allocated dip and a clone of dio_bio. | 8648 | * callbacks - they require an allocated dip and a clone of dio_bio. |
8650 | */ | 8649 | */ |
8651 | if (io_bio && dip) { | 8650 | if (io_bio && dip) { |
8652 | io_bio->bi_error = -EIO; | 8651 | io_bio->bi_status = BLK_STS_IOERR; |
8653 | bio_endio(io_bio); | 8652 | bio_endio(io_bio); |
8654 | /* | 8653 | /* |
8655 | * The end io callbacks free our dip, do the final put on io_bio | 8654 | * The end io callbacks free our dip, do the final put on io_bio |
@@ -8668,7 +8667,7 @@ free_ordered: | |||
8668 | unlock_extent(&BTRFS_I(inode)->io_tree, file_offset, | 8667 | unlock_extent(&BTRFS_I(inode)->io_tree, file_offset, |
8669 | file_offset + dio_bio->bi_iter.bi_size - 1); | 8668 | file_offset + dio_bio->bi_iter.bi_size - 1); |
8670 | 8669 | ||
8671 | dio_bio->bi_error = -EIO; | 8670 | dio_bio->bi_status = BLK_STS_IOERR; |
8672 | /* | 8671 | /* |
8673 | * Releases and cleans up our dio_bio, no need to bio_put() | 8672 | * Releases and cleans up our dio_bio, no need to bio_put() |
8674 | * nor bio_endio()/bio_io_error() against dio_bio. | 8673 | * nor bio_endio()/bio_io_error() against dio_bio. |
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index d8ea0eb76325..f3d30d9ea8f9 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
@@ -871,7 +871,7 @@ static void free_raid_bio(struct btrfs_raid_bio *rbio) | |||
871 | * this frees the rbio and runs through all the bios in the | 871 | * this frees the rbio and runs through all the bios in the |
872 | * bio_list and calls end_io on them | 872 | * bio_list and calls end_io on them |
873 | */ | 873 | */ |
874 | static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, int err) | 874 | static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t err) |
875 | { | 875 | { |
876 | struct bio *cur = bio_list_get(&rbio->bio_list); | 876 | struct bio *cur = bio_list_get(&rbio->bio_list); |
877 | struct bio *next; | 877 | struct bio *next; |
@@ -884,7 +884,7 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, int err) | |||
884 | while (cur) { | 884 | while (cur) { |
885 | next = cur->bi_next; | 885 | next = cur->bi_next; |
886 | cur->bi_next = NULL; | 886 | cur->bi_next = NULL; |
887 | cur->bi_error = err; | 887 | cur->bi_status = err; |
888 | bio_endio(cur); | 888 | bio_endio(cur); |
889 | cur = next; | 889 | cur = next; |
890 | } | 890 | } |
@@ -897,7 +897,7 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, int err) | |||
897 | static void raid_write_end_io(struct bio *bio) | 897 | static void raid_write_end_io(struct bio *bio) |
898 | { | 898 | { |
899 | struct btrfs_raid_bio *rbio = bio->bi_private; | 899 | struct btrfs_raid_bio *rbio = bio->bi_private; |
900 | int err = bio->bi_error; | 900 | blk_status_t err = bio->bi_status; |
901 | int max_errors; | 901 | int max_errors; |
902 | 902 | ||
903 | if (err) | 903 | if (err) |
@@ -914,7 +914,7 @@ static void raid_write_end_io(struct bio *bio) | |||
914 | max_errors = (rbio->operation == BTRFS_RBIO_PARITY_SCRUB) ? | 914 | max_errors = (rbio->operation == BTRFS_RBIO_PARITY_SCRUB) ? |
915 | 0 : rbio->bbio->max_errors; | 915 | 0 : rbio->bbio->max_errors; |
916 | if (atomic_read(&rbio->error) > max_errors) | 916 | if (atomic_read(&rbio->error) > max_errors) |
917 | err = -EIO; | 917 | err = BLK_STS_IOERR; |
918 | 918 | ||
919 | rbio_orig_end_io(rbio, err); | 919 | rbio_orig_end_io(rbio, err); |
920 | } | 920 | } |
@@ -1092,7 +1092,7 @@ static int rbio_add_io_page(struct btrfs_raid_bio *rbio, | |||
1092 | * devices or if they are not contiguous | 1092 | * devices or if they are not contiguous |
1093 | */ | 1093 | */ |
1094 | if (last_end == disk_start && stripe->dev->bdev && | 1094 | if (last_end == disk_start && stripe->dev->bdev && |
1095 | !last->bi_error && | 1095 | !last->bi_status && |
1096 | last->bi_bdev == stripe->dev->bdev) { | 1096 | last->bi_bdev == stripe->dev->bdev) { |
1097 | ret = bio_add_page(last, page, PAGE_SIZE, 0); | 1097 | ret = bio_add_page(last, page, PAGE_SIZE, 0); |
1098 | if (ret == PAGE_SIZE) | 1098 | if (ret == PAGE_SIZE) |
@@ -1448,7 +1448,7 @@ static void raid_rmw_end_io(struct bio *bio) | |||
1448 | { | 1448 | { |
1449 | struct btrfs_raid_bio *rbio = bio->bi_private; | 1449 | struct btrfs_raid_bio *rbio = bio->bi_private; |
1450 | 1450 | ||
1451 | if (bio->bi_error) | 1451 | if (bio->bi_status) |
1452 | fail_bio_stripe(rbio, bio); | 1452 | fail_bio_stripe(rbio, bio); |
1453 | else | 1453 | else |
1454 | set_bio_pages_uptodate(bio); | 1454 | set_bio_pages_uptodate(bio); |
@@ -1991,7 +1991,7 @@ static void raid_recover_end_io(struct bio *bio) | |||
1991 | * we only read stripe pages off the disk, set them | 1991 | * we only read stripe pages off the disk, set them |
1992 | * up to date if there were no errors | 1992 | * up to date if there were no errors |
1993 | */ | 1993 | */ |
1994 | if (bio->bi_error) | 1994 | if (bio->bi_status) |
1995 | fail_bio_stripe(rbio, bio); | 1995 | fail_bio_stripe(rbio, bio); |
1996 | else | 1996 | else |
1997 | set_bio_pages_uptodate(bio); | 1997 | set_bio_pages_uptodate(bio); |
@@ -2530,7 +2530,7 @@ static void raid56_parity_scrub_end_io(struct bio *bio) | |||
2530 | { | 2530 | { |
2531 | struct btrfs_raid_bio *rbio = bio->bi_private; | 2531 | struct btrfs_raid_bio *rbio = bio->bi_private; |
2532 | 2532 | ||
2533 | if (bio->bi_error) | 2533 | if (bio->bi_status) |
2534 | fail_bio_stripe(rbio, bio); | 2534 | fail_bio_stripe(rbio, bio); |
2535 | else | 2535 | else |
2536 | set_bio_pages_uptodate(bio); | 2536 | set_bio_pages_uptodate(bio); |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index c7b45eb2403d..ba5595d19de1 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -95,7 +95,7 @@ struct scrub_bio { | |||
95 | struct scrub_ctx *sctx; | 95 | struct scrub_ctx *sctx; |
96 | struct btrfs_device *dev; | 96 | struct btrfs_device *dev; |
97 | struct bio *bio; | 97 | struct bio *bio; |
98 | int err; | 98 | blk_status_t status; |
99 | u64 logical; | 99 | u64 logical; |
100 | u64 physical; | 100 | u64 physical; |
101 | #if SCRUB_PAGES_PER_WR_BIO >= SCRUB_PAGES_PER_RD_BIO | 101 | #if SCRUB_PAGES_PER_WR_BIO >= SCRUB_PAGES_PER_RD_BIO |
@@ -1668,14 +1668,14 @@ leave_nomem: | |||
1668 | 1668 | ||
1669 | struct scrub_bio_ret { | 1669 | struct scrub_bio_ret { |
1670 | struct completion event; | 1670 | struct completion event; |
1671 | int error; | 1671 | blk_status_t status; |
1672 | }; | 1672 | }; |
1673 | 1673 | ||
1674 | static void scrub_bio_wait_endio(struct bio *bio) | 1674 | static void scrub_bio_wait_endio(struct bio *bio) |
1675 | { | 1675 | { |
1676 | struct scrub_bio_ret *ret = bio->bi_private; | 1676 | struct scrub_bio_ret *ret = bio->bi_private; |
1677 | 1677 | ||
1678 | ret->error = bio->bi_error; | 1678 | ret->status = bio->bi_status; |
1679 | complete(&ret->event); | 1679 | complete(&ret->event); |
1680 | } | 1680 | } |
1681 | 1681 | ||
@@ -1693,7 +1693,7 @@ static int scrub_submit_raid56_bio_wait(struct btrfs_fs_info *fs_info, | |||
1693 | int ret; | 1693 | int ret; |
1694 | 1694 | ||
1695 | init_completion(&done.event); | 1695 | init_completion(&done.event); |
1696 | done.error = 0; | 1696 | done.status = 0; |
1697 | bio->bi_iter.bi_sector = page->logical >> 9; | 1697 | bio->bi_iter.bi_sector = page->logical >> 9; |
1698 | bio->bi_private = &done; | 1698 | bio->bi_private = &done; |
1699 | bio->bi_end_io = scrub_bio_wait_endio; | 1699 | bio->bi_end_io = scrub_bio_wait_endio; |
@@ -1705,7 +1705,7 @@ static int scrub_submit_raid56_bio_wait(struct btrfs_fs_info *fs_info, | |||
1705 | return ret; | 1705 | return ret; |
1706 | 1706 | ||
1707 | wait_for_completion(&done.event); | 1707 | wait_for_completion(&done.event); |
1708 | if (done.error) | 1708 | if (done.status) |
1709 | return -EIO; | 1709 | return -EIO; |
1710 | 1710 | ||
1711 | return 0; | 1711 | return 0; |
@@ -1937,7 +1937,7 @@ again: | |||
1937 | bio->bi_bdev = sbio->dev->bdev; | 1937 | bio->bi_bdev = sbio->dev->bdev; |
1938 | bio->bi_iter.bi_sector = sbio->physical >> 9; | 1938 | bio->bi_iter.bi_sector = sbio->physical >> 9; |
1939 | bio_set_op_attrs(bio, REQ_OP_WRITE, 0); | 1939 | bio_set_op_attrs(bio, REQ_OP_WRITE, 0); |
1940 | sbio->err = 0; | 1940 | sbio->status = 0; |
1941 | } else if (sbio->physical + sbio->page_count * PAGE_SIZE != | 1941 | } else if (sbio->physical + sbio->page_count * PAGE_SIZE != |
1942 | spage->physical_for_dev_replace || | 1942 | spage->physical_for_dev_replace || |
1943 | sbio->logical + sbio->page_count * PAGE_SIZE != | 1943 | sbio->logical + sbio->page_count * PAGE_SIZE != |
@@ -1992,7 +1992,7 @@ static void scrub_wr_bio_end_io(struct bio *bio) | |||
1992 | struct scrub_bio *sbio = bio->bi_private; | 1992 | struct scrub_bio *sbio = bio->bi_private; |
1993 | struct btrfs_fs_info *fs_info = sbio->dev->fs_info; | 1993 | struct btrfs_fs_info *fs_info = sbio->dev->fs_info; |
1994 | 1994 | ||
1995 | sbio->err = bio->bi_error; | 1995 | sbio->status = bio->bi_status; |
1996 | sbio->bio = bio; | 1996 | sbio->bio = bio; |
1997 | 1997 | ||
1998 | btrfs_init_work(&sbio->work, btrfs_scrubwrc_helper, | 1998 | btrfs_init_work(&sbio->work, btrfs_scrubwrc_helper, |
@@ -2007,7 +2007,7 @@ static void scrub_wr_bio_end_io_worker(struct btrfs_work *work) | |||
2007 | int i; | 2007 | int i; |
2008 | 2008 | ||
2009 | WARN_ON(sbio->page_count > SCRUB_PAGES_PER_WR_BIO); | 2009 | WARN_ON(sbio->page_count > SCRUB_PAGES_PER_WR_BIO); |
2010 | if (sbio->err) { | 2010 | if (sbio->status) { |
2011 | struct btrfs_dev_replace *dev_replace = | 2011 | struct btrfs_dev_replace *dev_replace = |
2012 | &sbio->sctx->fs_info->dev_replace; | 2012 | &sbio->sctx->fs_info->dev_replace; |
2013 | 2013 | ||
@@ -2341,7 +2341,7 @@ again: | |||
2341 | bio->bi_bdev = sbio->dev->bdev; | 2341 | bio->bi_bdev = sbio->dev->bdev; |
2342 | bio->bi_iter.bi_sector = sbio->physical >> 9; | 2342 | bio->bi_iter.bi_sector = sbio->physical >> 9; |
2343 | bio_set_op_attrs(bio, REQ_OP_READ, 0); | 2343 | bio_set_op_attrs(bio, REQ_OP_READ, 0); |
2344 | sbio->err = 0; | 2344 | sbio->status = 0; |
2345 | } else if (sbio->physical + sbio->page_count * PAGE_SIZE != | 2345 | } else if (sbio->physical + sbio->page_count * PAGE_SIZE != |
2346 | spage->physical || | 2346 | spage->physical || |
2347 | sbio->logical + sbio->page_count * PAGE_SIZE != | 2347 | sbio->logical + sbio->page_count * PAGE_SIZE != |
@@ -2377,7 +2377,7 @@ static void scrub_missing_raid56_end_io(struct bio *bio) | |||
2377 | struct scrub_block *sblock = bio->bi_private; | 2377 | struct scrub_block *sblock = bio->bi_private; |
2378 | struct btrfs_fs_info *fs_info = sblock->sctx->fs_info; | 2378 | struct btrfs_fs_info *fs_info = sblock->sctx->fs_info; |
2379 | 2379 | ||
2380 | if (bio->bi_error) | 2380 | if (bio->bi_status) |
2381 | sblock->no_io_error_seen = 0; | 2381 | sblock->no_io_error_seen = 0; |
2382 | 2382 | ||
2383 | bio_put(bio); | 2383 | bio_put(bio); |
@@ -2588,7 +2588,7 @@ static void scrub_bio_end_io(struct bio *bio) | |||
2588 | struct scrub_bio *sbio = bio->bi_private; | 2588 | struct scrub_bio *sbio = bio->bi_private; |
2589 | struct btrfs_fs_info *fs_info = sbio->dev->fs_info; | 2589 | struct btrfs_fs_info *fs_info = sbio->dev->fs_info; |
2590 | 2590 | ||
2591 | sbio->err = bio->bi_error; | 2591 | sbio->status = bio->bi_status; |
2592 | sbio->bio = bio; | 2592 | sbio->bio = bio; |
2593 | 2593 | ||
2594 | btrfs_queue_work(fs_info->scrub_workers, &sbio->work); | 2594 | btrfs_queue_work(fs_info->scrub_workers, &sbio->work); |
@@ -2601,7 +2601,7 @@ static void scrub_bio_end_io_worker(struct btrfs_work *work) | |||
2601 | int i; | 2601 | int i; |
2602 | 2602 | ||
2603 | BUG_ON(sbio->page_count > SCRUB_PAGES_PER_RD_BIO); | 2603 | BUG_ON(sbio->page_count > SCRUB_PAGES_PER_RD_BIO); |
2604 | if (sbio->err) { | 2604 | if (sbio->status) { |
2605 | for (i = 0; i < sbio->page_count; i++) { | 2605 | for (i = 0; i < sbio->page_count; i++) { |
2606 | struct scrub_page *spage = sbio->pagev[i]; | 2606 | struct scrub_page *spage = sbio->pagev[i]; |
2607 | 2607 | ||
@@ -3004,7 +3004,7 @@ static void scrub_parity_bio_endio(struct bio *bio) | |||
3004 | struct scrub_parity *sparity = (struct scrub_parity *)bio->bi_private; | 3004 | struct scrub_parity *sparity = (struct scrub_parity *)bio->bi_private; |
3005 | struct btrfs_fs_info *fs_info = sparity->sctx->fs_info; | 3005 | struct btrfs_fs_info *fs_info = sparity->sctx->fs_info; |
3006 | 3006 | ||
3007 | if (bio->bi_error) | 3007 | if (bio->bi_status) |
3008 | bitmap_or(sparity->ebitmap, sparity->ebitmap, sparity->dbitmap, | 3008 | bitmap_or(sparity->ebitmap, sparity->ebitmap, sparity->dbitmap, |
3009 | sparity->nsectors); | 3009 | sparity->nsectors); |
3010 | 3010 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 017b67daa3bb..84a495967e0a 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -6042,9 +6042,10 @@ static void btrfs_end_bio(struct bio *bio) | |||
6042 | struct btrfs_bio *bbio = bio->bi_private; | 6042 | struct btrfs_bio *bbio = bio->bi_private; |
6043 | int is_orig_bio = 0; | 6043 | int is_orig_bio = 0; |
6044 | 6044 | ||
6045 | if (bio->bi_error) { | 6045 | if (bio->bi_status) { |
6046 | atomic_inc(&bbio->error); | 6046 | atomic_inc(&bbio->error); |
6047 | if (bio->bi_error == -EIO || bio->bi_error == -EREMOTEIO) { | 6047 | if (bio->bi_status == BLK_STS_IOERR || |
6048 | bio->bi_status == BLK_STS_TARGET) { | ||
6048 | unsigned int stripe_index = | 6049 | unsigned int stripe_index = |
6049 | btrfs_io_bio(bio)->stripe_index; | 6050 | btrfs_io_bio(bio)->stripe_index; |
6050 | struct btrfs_device *dev; | 6051 | struct btrfs_device *dev; |
@@ -6082,13 +6083,13 @@ static void btrfs_end_bio(struct bio *bio) | |||
6082 | * beyond the tolerance of the btrfs bio | 6083 | * beyond the tolerance of the btrfs bio |
6083 | */ | 6084 | */ |
6084 | if (atomic_read(&bbio->error) > bbio->max_errors) { | 6085 | if (atomic_read(&bbio->error) > bbio->max_errors) { |
6085 | bio->bi_error = -EIO; | 6086 | bio->bi_status = BLK_STS_IOERR; |
6086 | } else { | 6087 | } else { |
6087 | /* | 6088 | /* |
6088 | * this bio is actually up to date, we didn't | 6089 | * this bio is actually up to date, we didn't |
6089 | * go over the max number of errors | 6090 | * go over the max number of errors |
6090 | */ | 6091 | */ |
6091 | bio->bi_error = 0; | 6092 | bio->bi_status = 0; |
6092 | } | 6093 | } |
6093 | 6094 | ||
6094 | btrfs_end_bbio(bbio, bio); | 6095 | btrfs_end_bbio(bbio, bio); |
@@ -6199,7 +6200,7 @@ static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical) | |||
6199 | 6200 | ||
6200 | btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; | 6201 | btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; |
6201 | bio->bi_iter.bi_sector = logical >> 9; | 6202 | bio->bi_iter.bi_sector = logical >> 9; |
6202 | bio->bi_error = -EIO; | 6203 | bio->bi_status = BLK_STS_IOERR; |
6203 | btrfs_end_bbio(bbio, bio); | 6204 | btrfs_end_bbio(bbio, bio); |
6204 | } | 6205 | } |
6205 | } | 6206 | } |