aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index f883b7e37f3d..e8f102ea9b03 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -213,7 +213,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock);
213 213
214static int md_fail_request (struct request_queue *q, struct bio *bio) 214static int md_fail_request (struct request_queue *q, struct bio *bio)
215{ 215{
216 bio_io_error(bio, bio->bi_size); 216 bio_io_error(bio);
217 return 0; 217 return 0;
218} 218}
219 219
@@ -384,12 +384,10 @@ static void free_disk_sb(mdk_rdev_t * rdev)
384} 384}
385 385
386 386
387static int super_written(struct bio *bio, unsigned int bytes_done, int error) 387static void super_written(struct bio *bio, int error)
388{ 388{
389 mdk_rdev_t *rdev = bio->bi_private; 389 mdk_rdev_t *rdev = bio->bi_private;
390 mddev_t *mddev = rdev->mddev; 390 mddev_t *mddev = rdev->mddev;
391 if (bio->bi_size)
392 return 1;
393 391
394 if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) { 392 if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) {
395 printk("md: super_written gets error=%d, uptodate=%d\n", 393 printk("md: super_written gets error=%d, uptodate=%d\n",
@@ -401,16 +399,13 @@ static int super_written(struct bio *bio, unsigned int bytes_done, int error)
401 if (atomic_dec_and_test(&mddev->pending_writes)) 399 if (atomic_dec_and_test(&mddev->pending_writes))
402 wake_up(&mddev->sb_wait); 400 wake_up(&mddev->sb_wait);
403 bio_put(bio); 401 bio_put(bio);
404 return 0;
405} 402}
406 403
407static int super_written_barrier(struct bio *bio, unsigned int bytes_done, int error) 404static void super_written_barrier(struct bio *bio, int error)
408{ 405{
409 struct bio *bio2 = bio->bi_private; 406 struct bio *bio2 = bio->bi_private;
410 mdk_rdev_t *rdev = bio2->bi_private; 407 mdk_rdev_t *rdev = bio2->bi_private;
411 mddev_t *mddev = rdev->mddev; 408 mddev_t *mddev = rdev->mddev;
412 if (bio->bi_size)
413 return 1;
414 409
415 if (!test_bit(BIO_UPTODATE, &bio->bi_flags) && 410 if (!test_bit(BIO_UPTODATE, &bio->bi_flags) &&
416 error == -EOPNOTSUPP) { 411 error == -EOPNOTSUPP) {
@@ -424,11 +419,11 @@ static int super_written_barrier(struct bio *bio, unsigned int bytes_done, int e
424 spin_unlock_irqrestore(&mddev->write_lock, flags); 419 spin_unlock_irqrestore(&mddev->write_lock, flags);
425 wake_up(&mddev->sb_wait); 420 wake_up(&mddev->sb_wait);
426 bio_put(bio); 421 bio_put(bio);
427 return 0; 422 } else {
423 bio_put(bio2);
424 bio->bi_private = rdev;
425 super_written(bio, error);
428 } 426 }
429 bio_put(bio2);
430 bio->bi_private = rdev;
431 return super_written(bio, bytes_done, error);
432} 427}
433 428
434void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, 429void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
@@ -489,13 +484,9 @@ void md_super_wait(mddev_t *mddev)
489 finish_wait(&mddev->sb_wait, &wq); 484 finish_wait(&mddev->sb_wait, &wq);
490} 485}
491 486
492static int bi_complete(struct bio *bio, unsigned int bytes_done, int error) 487static void bi_complete(struct bio *bio, int error)
493{ 488{
494 if (bio->bi_size)
495 return 1;
496
497 complete((struct completion*)bio->bi_private); 489 complete((struct completion*)bio->bi_private);
498 return 0;
499} 490}
500 491
501int sync_page_io(struct block_device *bdev, sector_t sector, int size, 492int sync_page_io(struct block_device *bdev, sector_t sector, int size,