diff options
-rw-r--r-- | block/blk-flush.c | 19 | ||||
-rw-r--r-- | drivers/md/md.c | 12 | ||||
-rw-r--r-- | fs/btrfs/check-integrity.c | 32 | ||||
-rw-r--r-- | fs/btrfs/check-integrity.h | 2 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 12 | ||||
-rw-r--r-- | fs/btrfs/scrub.c | 33 | ||||
-rw-r--r-- | fs/hfsplus/wrapper.c | 17 | ||||
-rw-r--r-- | fs/logfs/dev_bdev.c | 13 |
8 files changed, 24 insertions, 116 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c index 331e627301ea..fb6f3c0ffa49 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -502,15 +502,6 @@ void blk_abort_flushes(struct request_queue *q) | |||
502 | } | 502 | } |
503 | } | 503 | } |
504 | 504 | ||
505 | static void bio_end_flush(struct bio *bio, int err) | ||
506 | { | ||
507 | if (err) | ||
508 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
509 | if (bio->bi_private) | ||
510 | complete(bio->bi_private); | ||
511 | bio_put(bio); | ||
512 | } | ||
513 | |||
514 | /** | 505 | /** |
515 | * blkdev_issue_flush - queue a flush | 506 | * blkdev_issue_flush - queue a flush |
516 | * @bdev: blockdev to issue flush for | 507 | * @bdev: blockdev to issue flush for |
@@ -526,7 +517,6 @@ static void bio_end_flush(struct bio *bio, int err) | |||
526 | int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | 517 | int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, |
527 | sector_t *error_sector) | 518 | sector_t *error_sector) |
528 | { | 519 | { |
529 | DECLARE_COMPLETION_ONSTACK(wait); | ||
530 | struct request_queue *q; | 520 | struct request_queue *q; |
531 | struct bio *bio; | 521 | struct bio *bio; |
532 | int ret = 0; | 522 | int ret = 0; |
@@ -548,13 +538,9 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
548 | return -ENXIO; | 538 | return -ENXIO; |
549 | 539 | ||
550 | bio = bio_alloc(gfp_mask, 0); | 540 | bio = bio_alloc(gfp_mask, 0); |
551 | bio->bi_end_io = bio_end_flush; | ||
552 | bio->bi_bdev = bdev; | 541 | bio->bi_bdev = bdev; |
553 | bio->bi_private = &wait; | ||
554 | 542 | ||
555 | bio_get(bio); | 543 | ret = submit_bio_wait(WRITE_FLUSH, bio); |
556 | submit_bio(WRITE_FLUSH, bio); | ||
557 | wait_for_completion_io(&wait); | ||
558 | 544 | ||
559 | /* | 545 | /* |
560 | * The driver must store the error location in ->bi_sector, if | 546 | * The driver must store the error location in ->bi_sector, if |
@@ -564,9 +550,6 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
564 | if (error_sector) | 550 | if (error_sector) |
565 | *error_sector = bio->bi_sector; | 551 | *error_sector = bio->bi_sector; |
566 | 552 | ||
567 | if (!bio_flagged(bio, BIO_UPTODATE)) | ||
568 | ret = -EIO; | ||
569 | |||
570 | bio_put(bio); | 553 | bio_put(bio); |
571 | return ret; | 554 | return ret; |
572 | } | 555 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index b6b7a2866c9e..8700de376876 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -776,16 +776,10 @@ void md_super_wait(struct mddev *mddev) | |||
776 | finish_wait(&mddev->sb_wait, &wq); | 776 | finish_wait(&mddev->sb_wait, &wq); |
777 | } | 777 | } |
778 | 778 | ||
779 | static void bi_complete(struct bio *bio, int error) | ||
780 | { | ||
781 | complete((struct completion*)bio->bi_private); | ||
782 | } | ||
783 | |||
784 | int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, | 779 | int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, |
785 | struct page *page, int rw, bool metadata_op) | 780 | struct page *page, int rw, bool metadata_op) |
786 | { | 781 | { |
787 | struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); | 782 | struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); |
788 | struct completion event; | ||
789 | int ret; | 783 | int ret; |
790 | 784 | ||
791 | rw |= REQ_SYNC; | 785 | rw |= REQ_SYNC; |
@@ -801,11 +795,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, | |||
801 | else | 795 | else |
802 | bio->bi_sector = sector + rdev->data_offset; | 796 | bio->bi_sector = sector + rdev->data_offset; |
803 | bio_add_page(bio, page, size, 0); | 797 | bio_add_page(bio, page, size, 0); |
804 | init_completion(&event); | 798 | submit_bio_wait(rw, bio); |
805 | bio->bi_private = &event; | ||
806 | bio->bi_end_io = bi_complete; | ||
807 | submit_bio(rw, bio); | ||
808 | wait_for_completion(&event); | ||
809 | 799 | ||
810 | ret = test_bit(BIO_UPTODATE, &bio->bi_flags); | 800 | ret = test_bit(BIO_UPTODATE, &bio->bi_flags); |
811 | bio_put(bio); | 801 | bio_put(bio); |
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index e0aab4456974..f85b1c409003 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
@@ -323,7 +323,6 @@ static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx); | |||
323 | static int btrfsic_read_block(struct btrfsic_state *state, | 323 | static int btrfsic_read_block(struct btrfsic_state *state, |
324 | struct btrfsic_block_data_ctx *block_ctx); | 324 | struct btrfsic_block_data_ctx *block_ctx); |
325 | static void btrfsic_dump_database(struct btrfsic_state *state); | 325 | static void btrfsic_dump_database(struct btrfsic_state *state); |
326 | static void btrfsic_complete_bio_end_io(struct bio *bio, int err); | ||
327 | static int btrfsic_test_for_metadata(struct btrfsic_state *state, | 326 | static int btrfsic_test_for_metadata(struct btrfsic_state *state, |
328 | char **datav, unsigned int num_pages); | 327 | char **datav, unsigned int num_pages); |
329 | static void btrfsic_process_written_block(struct btrfsic_dev_state *dev_state, | 328 | static void btrfsic_process_written_block(struct btrfsic_dev_state *dev_state, |
@@ -1677,7 +1676,6 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1677 | for (i = 0; i < num_pages;) { | 1676 | for (i = 0; i < num_pages;) { |
1678 | struct bio *bio; | 1677 | struct bio *bio; |
1679 | unsigned int j; | 1678 | unsigned int j; |
1680 | DECLARE_COMPLETION_ONSTACK(complete); | ||
1681 | 1679 | ||
1682 | bio = btrfs_io_bio_alloc(GFP_NOFS, num_pages - i); | 1680 | bio = btrfs_io_bio_alloc(GFP_NOFS, num_pages - i); |
1683 | if (!bio) { | 1681 | if (!bio) { |
@@ -1688,8 +1686,6 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1688 | } | 1686 | } |
1689 | bio->bi_bdev = block_ctx->dev->bdev; | 1687 | bio->bi_bdev = block_ctx->dev->bdev; |
1690 | bio->bi_sector = dev_bytenr >> 9; | 1688 | bio->bi_sector = dev_bytenr >> 9; |
1691 | bio->bi_end_io = btrfsic_complete_bio_end_io; | ||
1692 | bio->bi_private = &complete; | ||
1693 | 1689 | ||
1694 | for (j = i; j < num_pages; j++) { | 1690 | for (j = i; j < num_pages; j++) { |
1695 | ret = bio_add_page(bio, block_ctx->pagev[j], | 1691 | ret = bio_add_page(bio, block_ctx->pagev[j], |
@@ -1702,12 +1698,7 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1702 | "btrfsic: error, failed to add a single page!\n"); | 1698 | "btrfsic: error, failed to add a single page!\n"); |
1703 | return -1; | 1699 | return -1; |
1704 | } | 1700 | } |
1705 | submit_bio(READ, bio); | 1701 | if (submit_bio_wait(READ, bio)) { |
1706 | |||
1707 | /* this will also unplug the queue */ | ||
1708 | wait_for_completion(&complete); | ||
1709 | |||
1710 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { | ||
1711 | printk(KERN_INFO | 1702 | printk(KERN_INFO |
1712 | "btrfsic: read error at logical %llu dev %s!\n", | 1703 | "btrfsic: read error at logical %llu dev %s!\n", |
1713 | block_ctx->start, block_ctx->dev->name); | 1704 | block_ctx->start, block_ctx->dev->name); |
@@ -1730,11 +1721,6 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1730 | return block_ctx->len; | 1721 | return block_ctx->len; |
1731 | } | 1722 | } |
1732 | 1723 | ||
1733 | static void btrfsic_complete_bio_end_io(struct bio *bio, int err) | ||
1734 | { | ||
1735 | complete((struct completion *)bio->bi_private); | ||
1736 | } | ||
1737 | |||
1738 | static void btrfsic_dump_database(struct btrfsic_state *state) | 1724 | static void btrfsic_dump_database(struct btrfsic_state *state) |
1739 | { | 1725 | { |
1740 | struct list_head *elem_all; | 1726 | struct list_head *elem_all; |
@@ -2998,14 +2984,12 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh) | |||
2998 | return submit_bh(rw, bh); | 2984 | return submit_bh(rw, bh); |
2999 | } | 2985 | } |
3000 | 2986 | ||
3001 | void btrfsic_submit_bio(int rw, struct bio *bio) | 2987 | static void __btrfsic_submit_bio(int rw, struct bio *bio) |
3002 | { | 2988 | { |
3003 | struct btrfsic_dev_state *dev_state; | 2989 | struct btrfsic_dev_state *dev_state; |
3004 | 2990 | ||
3005 | if (!btrfsic_is_initialized) { | 2991 | if (!btrfsic_is_initialized) |
3006 | submit_bio(rw, bio); | ||
3007 | return; | 2992 | return; |
3008 | } | ||
3009 | 2993 | ||
3010 | mutex_lock(&btrfsic_mutex); | 2994 | mutex_lock(&btrfsic_mutex); |
3011 | /* since btrfsic_submit_bio() is also called before | 2995 | /* since btrfsic_submit_bio() is also called before |
@@ -3097,10 +3081,20 @@ void btrfsic_submit_bio(int rw, struct bio *bio) | |||
3097 | } | 3081 | } |
3098 | leave: | 3082 | leave: |
3099 | mutex_unlock(&btrfsic_mutex); | 3083 | mutex_unlock(&btrfsic_mutex); |
3084 | } | ||
3100 | 3085 | ||
3086 | void btrfsic_submit_bio(int rw, struct bio *bio) | ||
3087 | { | ||
3088 | __btrfsic_submit_bio(rw, bio); | ||
3101 | submit_bio(rw, bio); | 3089 | submit_bio(rw, bio); |
3102 | } | 3090 | } |
3103 | 3091 | ||
3092 | int btrfsic_submit_bio_wait(int rw, struct bio *bio) | ||
3093 | { | ||
3094 | __btrfsic_submit_bio(rw, bio); | ||
3095 | return submit_bio_wait(rw, bio); | ||
3096 | } | ||
3097 | |||
3104 | int btrfsic_mount(struct btrfs_root *root, | 3098 | int btrfsic_mount(struct btrfs_root *root, |
3105 | struct btrfs_fs_devices *fs_devices, | 3099 | struct btrfs_fs_devices *fs_devices, |
3106 | int including_extent_data, u32 print_mask) | 3100 | int including_extent_data, u32 print_mask) |
diff --git a/fs/btrfs/check-integrity.h b/fs/btrfs/check-integrity.h index 8b59175cc502..13b8566c97ab 100644 --- a/fs/btrfs/check-integrity.h +++ b/fs/btrfs/check-integrity.h | |||
@@ -22,9 +22,11 @@ | |||
22 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 22 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
23 | int btrfsic_submit_bh(int rw, struct buffer_head *bh); | 23 | int btrfsic_submit_bh(int rw, struct buffer_head *bh); |
24 | void btrfsic_submit_bio(int rw, struct bio *bio); | 24 | void btrfsic_submit_bio(int rw, struct bio *bio); |
25 | int btrfsic_submit_bio_wait(int rw, struct bio *bio); | ||
25 | #else | 26 | #else |
26 | #define btrfsic_submit_bh submit_bh | 27 | #define btrfsic_submit_bh submit_bh |
27 | #define btrfsic_submit_bio submit_bio | 28 | #define btrfsic_submit_bio submit_bio |
29 | #define btrfsic_submit_bio_wait submit_bio_wait | ||
28 | #endif | 30 | #endif |
29 | 31 | ||
30 | int btrfsic_mount(struct btrfs_root *root, | 32 | int btrfsic_mount(struct btrfs_root *root, |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 856bc2b2192c..014beaa9458c 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1952,11 +1952,6 @@ static int free_io_failure(struct inode *inode, struct io_failure_record *rec, | |||
1952 | return err; | 1952 | return err; |
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | static void repair_io_failure_callback(struct bio *bio, int err) | ||
1956 | { | ||
1957 | complete(bio->bi_private); | ||
1958 | } | ||
1959 | |||
1960 | /* | 1955 | /* |
1961 | * this bypasses the standard btrfs submit functions deliberately, as | 1956 | * this bypasses the standard btrfs submit functions deliberately, as |
1962 | * the standard behavior is to write all copies in a raid setup. here we only | 1957 | * the standard behavior is to write all copies in a raid setup. here we only |
@@ -1973,7 +1968,6 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start, | |||
1973 | { | 1968 | { |
1974 | struct bio *bio; | 1969 | struct bio *bio; |
1975 | struct btrfs_device *dev; | 1970 | struct btrfs_device *dev; |
1976 | DECLARE_COMPLETION_ONSTACK(compl); | ||
1977 | u64 map_length = 0; | 1971 | u64 map_length = 0; |
1978 | u64 sector; | 1972 | u64 sector; |
1979 | struct btrfs_bio *bbio = NULL; | 1973 | struct btrfs_bio *bbio = NULL; |
@@ -1989,8 +1983,6 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start, | |||
1989 | bio = btrfs_io_bio_alloc(GFP_NOFS, 1); | 1983 | bio = btrfs_io_bio_alloc(GFP_NOFS, 1); |
1990 | if (!bio) | 1984 | if (!bio) |
1991 | return -EIO; | 1985 | return -EIO; |
1992 | bio->bi_private = &compl; | ||
1993 | bio->bi_end_io = repair_io_failure_callback; | ||
1994 | bio->bi_size = 0; | 1986 | bio->bi_size = 0; |
1995 | map_length = length; | 1987 | map_length = length; |
1996 | 1988 | ||
@@ -2011,10 +2003,8 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start, | |||
2011 | } | 2003 | } |
2012 | bio->bi_bdev = dev->bdev; | 2004 | bio->bi_bdev = dev->bdev; |
2013 | bio_add_page(bio, page, length, start - page_offset(page)); | 2005 | bio_add_page(bio, page, length, start - page_offset(page)); |
2014 | btrfsic_submit_bio(WRITE_SYNC, bio); | ||
2015 | wait_for_completion(&compl); | ||
2016 | 2006 | ||
2017 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { | 2007 | if (btrfsic_submit_bio_wait(WRITE_SYNC, bio)) { |
2018 | /* try to remap that extent elsewhere? */ | 2008 | /* try to remap that extent elsewhere? */ |
2019 | bio_put(bio); | 2009 | bio_put(bio); |
2020 | btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); | 2010 | btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 2544805544f0..3214ebe593bd 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -208,7 +208,6 @@ static void scrub_recheck_block_checksum(struct btrfs_fs_info *fs_info, | |||
208 | int is_metadata, int have_csum, | 208 | int is_metadata, int have_csum, |
209 | const u8 *csum, u64 generation, | 209 | const u8 *csum, u64 generation, |
210 | u16 csum_size); | 210 | u16 csum_size); |
211 | static void scrub_complete_bio_end_io(struct bio *bio, int err); | ||
212 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, | 211 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, |
213 | struct scrub_block *sblock_good, | 212 | struct scrub_block *sblock_good, |
214 | int force_write); | 213 | int force_write); |
@@ -1292,7 +1291,6 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info, | |||
1292 | for (page_num = 0; page_num < sblock->page_count; page_num++) { | 1291 | for (page_num = 0; page_num < sblock->page_count; page_num++) { |
1293 | struct bio *bio; | 1292 | struct bio *bio; |
1294 | struct scrub_page *page = sblock->pagev[page_num]; | 1293 | struct scrub_page *page = sblock->pagev[page_num]; |
1295 | DECLARE_COMPLETION_ONSTACK(complete); | ||
1296 | 1294 | ||
1297 | if (page->dev->bdev == NULL) { | 1295 | if (page->dev->bdev == NULL) { |
1298 | page->io_error = 1; | 1296 | page->io_error = 1; |
@@ -1309,18 +1307,11 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info, | |||
1309 | } | 1307 | } |
1310 | bio->bi_bdev = page->dev->bdev; | 1308 | bio->bi_bdev = page->dev->bdev; |
1311 | bio->bi_sector = page->physical >> 9; | 1309 | bio->bi_sector = page->physical >> 9; |
1312 | bio->bi_end_io = scrub_complete_bio_end_io; | ||
1313 | bio->bi_private = &complete; | ||
1314 | 1310 | ||
1315 | bio_add_page(bio, page->page, PAGE_SIZE, 0); | 1311 | bio_add_page(bio, page->page, PAGE_SIZE, 0); |
1316 | btrfsic_submit_bio(READ, bio); | 1312 | if (btrfsic_submit_bio_wait(READ, bio)) |
1317 | |||
1318 | /* this will also unplug the queue */ | ||
1319 | wait_for_completion(&complete); | ||
1320 | |||
1321 | page->io_error = !test_bit(BIO_UPTODATE, &bio->bi_flags); | ||
1322 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | ||
1323 | sblock->no_io_error_seen = 0; | 1313 | sblock->no_io_error_seen = 0; |
1314 | |||
1324 | bio_put(bio); | 1315 | bio_put(bio); |
1325 | } | 1316 | } |
1326 | 1317 | ||
@@ -1389,11 +1380,6 @@ static void scrub_recheck_block_checksum(struct btrfs_fs_info *fs_info, | |||
1389 | sblock->checksum_error = 1; | 1380 | sblock->checksum_error = 1; |
1390 | } | 1381 | } |
1391 | 1382 | ||
1392 | static void scrub_complete_bio_end_io(struct bio *bio, int err) | ||
1393 | { | ||
1394 | complete((struct completion *)bio->bi_private); | ||
1395 | } | ||
1396 | |||
1397 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, | 1383 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, |
1398 | struct scrub_block *sblock_good, | 1384 | struct scrub_block *sblock_good, |
1399 | int force_write) | 1385 | int force_write) |
@@ -1428,7 +1414,6 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad, | |||
1428 | sblock_bad->checksum_error || page_bad->io_error) { | 1414 | sblock_bad->checksum_error || page_bad->io_error) { |
1429 | struct bio *bio; | 1415 | struct bio *bio; |
1430 | int ret; | 1416 | int ret; |
1431 | DECLARE_COMPLETION_ONSTACK(complete); | ||
1432 | 1417 | ||
1433 | if (!page_bad->dev->bdev) { | 1418 | if (!page_bad->dev->bdev) { |
1434 | printk_ratelimited(KERN_WARNING | 1419 | printk_ratelimited(KERN_WARNING |
@@ -1441,19 +1426,14 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad, | |||
1441 | return -EIO; | 1426 | return -EIO; |
1442 | bio->bi_bdev = page_bad->dev->bdev; | 1427 | bio->bi_bdev = page_bad->dev->bdev; |
1443 | bio->bi_sector = page_bad->physical >> 9; | 1428 | bio->bi_sector = page_bad->physical >> 9; |
1444 | bio->bi_end_io = scrub_complete_bio_end_io; | ||
1445 | bio->bi_private = &complete; | ||
1446 | 1429 | ||
1447 | ret = bio_add_page(bio, page_good->page, PAGE_SIZE, 0); | 1430 | ret = bio_add_page(bio, page_good->page, PAGE_SIZE, 0); |
1448 | if (PAGE_SIZE != ret) { | 1431 | if (PAGE_SIZE != ret) { |
1449 | bio_put(bio); | 1432 | bio_put(bio); |
1450 | return -EIO; | 1433 | return -EIO; |
1451 | } | 1434 | } |
1452 | btrfsic_submit_bio(WRITE, bio); | ||
1453 | 1435 | ||
1454 | /* this will also unplug the queue */ | 1436 | if (btrfsic_submit_bio_wait(WRITE, bio)) { |
1455 | wait_for_completion(&complete); | ||
1456 | if (!bio_flagged(bio, BIO_UPTODATE)) { | ||
1457 | btrfs_dev_stat_inc_and_print(page_bad->dev, | 1437 | btrfs_dev_stat_inc_and_print(page_bad->dev, |
1458 | BTRFS_DEV_STAT_WRITE_ERRS); | 1438 | BTRFS_DEV_STAT_WRITE_ERRS); |
1459 | btrfs_dev_replace_stats_inc( | 1439 | btrfs_dev_replace_stats_inc( |
@@ -3373,7 +3353,6 @@ static int write_page_nocow(struct scrub_ctx *sctx, | |||
3373 | struct bio *bio; | 3353 | struct bio *bio; |
3374 | struct btrfs_device *dev; | 3354 | struct btrfs_device *dev; |
3375 | int ret; | 3355 | int ret; |
3376 | DECLARE_COMPLETION_ONSTACK(compl); | ||
3377 | 3356 | ||
3378 | dev = sctx->wr_ctx.tgtdev; | 3357 | dev = sctx->wr_ctx.tgtdev; |
3379 | if (!dev) | 3358 | if (!dev) |
@@ -3390,8 +3369,6 @@ static int write_page_nocow(struct scrub_ctx *sctx, | |||
3390 | spin_unlock(&sctx->stat_lock); | 3369 | spin_unlock(&sctx->stat_lock); |
3391 | return -ENOMEM; | 3370 | return -ENOMEM; |
3392 | } | 3371 | } |
3393 | bio->bi_private = &compl; | ||
3394 | bio->bi_end_io = scrub_complete_bio_end_io; | ||
3395 | bio->bi_size = 0; | 3372 | bio->bi_size = 0; |
3396 | bio->bi_sector = physical_for_dev_replace >> 9; | 3373 | bio->bi_sector = physical_for_dev_replace >> 9; |
3397 | bio->bi_bdev = dev->bdev; | 3374 | bio->bi_bdev = dev->bdev; |
@@ -3402,10 +3379,8 @@ leave_with_eio: | |||
3402 | btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); | 3379 | btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); |
3403 | return -EIO; | 3380 | return -EIO; |
3404 | } | 3381 | } |
3405 | btrfsic_submit_bio(WRITE_SYNC, bio); | ||
3406 | wait_for_completion(&compl); | ||
3407 | 3382 | ||
3408 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | 3383 | if (btrfsic_submit_bio_wait(WRITE_SYNC, bio)) |
3409 | goto leave_with_eio; | 3384 | goto leave_with_eio; |
3410 | 3385 | ||
3411 | bio_put(bio); | 3386 | bio_put(bio); |
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c index b51a6079108d..e9a97a0d4314 100644 --- a/fs/hfsplus/wrapper.c +++ b/fs/hfsplus/wrapper.c | |||
@@ -24,13 +24,6 @@ struct hfsplus_wd { | |||
24 | u16 embed_count; | 24 | u16 embed_count; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static void hfsplus_end_io_sync(struct bio *bio, int err) | ||
28 | { | ||
29 | if (err) | ||
30 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
31 | complete(bio->bi_private); | ||
32 | } | ||
33 | |||
34 | /* | 27 | /* |
35 | * hfsplus_submit_bio - Perfrom block I/O | 28 | * hfsplus_submit_bio - Perfrom block I/O |
36 | * @sb: super block of volume for I/O | 29 | * @sb: super block of volume for I/O |
@@ -53,7 +46,6 @@ static void hfsplus_end_io_sync(struct bio *bio, int err) | |||
53 | int hfsplus_submit_bio(struct super_block *sb, sector_t sector, | 46 | int hfsplus_submit_bio(struct super_block *sb, sector_t sector, |
54 | void *buf, void **data, int rw) | 47 | void *buf, void **data, int rw) |
55 | { | 48 | { |
56 | DECLARE_COMPLETION_ONSTACK(wait); | ||
57 | struct bio *bio; | 49 | struct bio *bio; |
58 | int ret = 0; | 50 | int ret = 0; |
59 | u64 io_size; | 51 | u64 io_size; |
@@ -73,8 +65,6 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, | |||
73 | bio = bio_alloc(GFP_NOIO, 1); | 65 | bio = bio_alloc(GFP_NOIO, 1); |
74 | bio->bi_sector = sector; | 66 | bio->bi_sector = sector; |
75 | bio->bi_bdev = sb->s_bdev; | 67 | bio->bi_bdev = sb->s_bdev; |
76 | bio->bi_end_io = hfsplus_end_io_sync; | ||
77 | bio->bi_private = &wait; | ||
78 | 68 | ||
79 | if (!(rw & WRITE) && data) | 69 | if (!(rw & WRITE) && data) |
80 | *data = (u8 *)buf + offset; | 70 | *data = (u8 *)buf + offset; |
@@ -93,12 +83,7 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, | |||
93 | buf = (u8 *)buf + len; | 83 | buf = (u8 *)buf + len; |
94 | } | 84 | } |
95 | 85 | ||
96 | submit_bio(rw, bio); | 86 | ret = submit_bio_wait(rw, bio); |
97 | wait_for_completion(&wait); | ||
98 | |||
99 | if (!bio_flagged(bio, BIO_UPTODATE)) | ||
100 | ret = -EIO; | ||
101 | |||
102 | out: | 87 | out: |
103 | bio_put(bio); | 88 | bio_put(bio); |
104 | return ret < 0 ? ret : 0; | 89 | return ret < 0 ? ret : 0; |
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c index 550475ca6a0e..0f95f0d0b313 100644 --- a/fs/logfs/dev_bdev.c +++ b/fs/logfs/dev_bdev.c | |||
@@ -14,16 +14,10 @@ | |||
14 | 14 | ||
15 | #define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) | 15 | #define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) |
16 | 16 | ||
17 | static void request_complete(struct bio *bio, int err) | ||
18 | { | ||
19 | complete((struct completion *)bio->bi_private); | ||
20 | } | ||
21 | |||
22 | static int sync_request(struct page *page, struct block_device *bdev, int rw) | 17 | static int sync_request(struct page *page, struct block_device *bdev, int rw) |
23 | { | 18 | { |
24 | struct bio bio; | 19 | struct bio bio; |
25 | struct bio_vec bio_vec; | 20 | struct bio_vec bio_vec; |
26 | struct completion complete; | ||
27 | 21 | ||
28 | bio_init(&bio); | 22 | bio_init(&bio); |
29 | bio.bi_max_vecs = 1; | 23 | bio.bi_max_vecs = 1; |
@@ -35,13 +29,8 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw) | |||
35 | bio.bi_size = PAGE_SIZE; | 29 | bio.bi_size = PAGE_SIZE; |
36 | bio.bi_bdev = bdev; | 30 | bio.bi_bdev = bdev; |
37 | bio.bi_sector = page->index * (PAGE_SIZE >> 9); | 31 | bio.bi_sector = page->index * (PAGE_SIZE >> 9); |
38 | init_completion(&complete); | ||
39 | bio.bi_private = &complete; | ||
40 | bio.bi_end_io = request_complete; | ||
41 | 32 | ||
42 | submit_bio(rw, &bio); | 33 | return submit_bio_wait(rw, &bio); |
43 | wait_for_completion(&complete); | ||
44 | return test_bit(BIO_UPTODATE, &bio.bi_flags) ? 0 : -EIO; | ||
45 | } | 34 | } |
46 | 35 | ||
47 | static int bdev_readpage(void *_sb, struct page *page) | 36 | static int bdev_readpage(void *_sb, struct page *page) |