diff options
author | Kent Overstreet <koverstreet@google.com> | 2012-09-10 17:41:12 -0400 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2013-03-23 17:15:32 -0400 |
commit | 9e882242c6193ae6f416f2d8d8db0d9126bd996b (patch) | |
tree | 388e4a9ef2ab3693eaee77a8bffabc62a9b86d7f /drivers/md/raid1.c | |
parent | 2f477877f8c4be18f054aeb7c4be8cc748cfe932 (diff) |
block: Add submit_bio_wait(), remove from md
Random cleanup - this code was duplicated and it's not really specific
to md.
Also added the ability to return the actual error code.
Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: NeilBrown <neilb@suse.de>
Acked-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index f741c9fe25c8..800748d585ca 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2059,25 +2059,6 @@ static void fix_read_error(struct r1conf *conf, int read_disk, | |||
2059 | } | 2059 | } |
2060 | } | 2060 | } |
2061 | 2061 | ||
2062 | static void bi_complete(struct bio *bio, int error) | ||
2063 | { | ||
2064 | complete((struct completion *)bio->bi_private); | ||
2065 | } | ||
2066 | |||
2067 | static int submit_bio_wait(int rw, struct bio *bio) | ||
2068 | { | ||
2069 | struct completion event; | ||
2070 | rw |= REQ_SYNC; | ||
2071 | |||
2072 | init_completion(&event); | ||
2073 | bio->bi_private = &event; | ||
2074 | bio->bi_end_io = bi_complete; | ||
2075 | submit_bio(rw, bio); | ||
2076 | wait_for_completion(&event); | ||
2077 | |||
2078 | return test_bit(BIO_UPTODATE, &bio->bi_flags); | ||
2079 | } | ||
2080 | |||
2081 | static int narrow_write_error(struct r1bio *r1_bio, int i) | 2062 | static int narrow_write_error(struct r1bio *r1_bio, int i) |
2082 | { | 2063 | { |
2083 | struct mddev *mddev = r1_bio->mddev; | 2064 | struct mddev *mddev = r1_bio->mddev; |