summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2012-09-10 14:41:12 -0700
committerKent Overstreet <koverstreet@google.com>2013-03-23 14:15:32 -0700
commit9e882242c6193ae6f416f2d8d8db0d9126bd996b (patch)
tree388e4a9ef2ab3693eaee77a8bffabc62a9b86d7f /drivers/md
parent2f477877f8c4be18f054aeb7c4be8cc748cfe932 (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')
-rw-r--r--drivers/md/raid1.c19
-rw-r--r--drivers/md/raid10.c19
2 files changed, 0 insertions, 38 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,
}
}
-static void bi_complete(struct bio *bio, int error)
-{
- complete((struct completion *)bio->bi_private);
-}
-
-static int submit_bio_wait(int rw, struct bio *bio)
-{
- struct completion event;
- rw |= REQ_SYNC;
-
- init_completion(&event);
- bio->bi_private = &event;
- bio->bi_end_io = bi_complete;
- submit_bio(rw, bio);
- wait_for_completion(&event);
-
- return test_bit(BIO_UPTODATE, &bio->bi_flags);
-}
-
static int narrow_write_error(struct r1bio *r1_bio, int i)
{
struct mddev *mddev = r1_bio->mddev;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 6ffb6c08aec5..434586d43115 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2529,25 +2529,6 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
}
}
-static void bi_complete(struct bio *bio, int error)
-{
- complete((struct completion *)bio->bi_private);
-}
-
-static int submit_bio_wait(int rw, struct bio *bio)
-{
- struct completion event;
- rw |= REQ_SYNC;
-
- init_completion(&event);
- bio->bi_private = &event;
- bio->bi_end_io = bi_complete;
- submit_bio(rw, bio);
- wait_for_completion(&event);
-
- return test_bit(BIO_UPTODATE, &bio->bi_flags);
-}
-
static int narrow_write_error(struct r10bio *r10_bio, int i)
{
struct bio *bio = r10_bio->master_bio;