diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-11-24 18:32:22 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-11-24 18:33:41 -0500 |
commit | c170bbb45febc03ac4d34ba2b8bb55e06104b7e7 (patch) | |
tree | ab1d6878c379b0eb59e58a1999e7c2d8c11ae303 /block | |
parent | 2c575026fae6e63771bd2a4c1d407214a8096a89 (diff) |
block: submit_bio_wait() conversions
It was being open coded in a few places.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Joern Engel <joern@logfs.org>
Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Chris Mason <chris.mason@fusionio.com>
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-flush.c | 19 |
1 files changed, 1 insertions, 18 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 | } |