aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-05-01 15:15:47 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-05-01 21:17:42 -0400
commit62de608da0b0ab17d81a233b50d1e952b9816f69 (patch)
tree12647d87f70cddf29edeeee2d85358667aa24cd8 /drivers
parentbea2771871ed1084c9a85ed0c86340f188505702 (diff)
[PATCH] md: Improve detection of lack of barrier support in raid1
Move the test for 'do barrier work' down a bit so that if the first write to a raid1 is a BIO_RW_BARRIER write, the checking done by superblock writes will cause the right thing to happen. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/raid1.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 532d04077301..b8c13c897ccb 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -753,18 +753,24 @@ static int make_request(request_queue_t *q, struct bio * bio)
753 const int rw = bio_data_dir(bio); 753 const int rw = bio_data_dir(bio);
754 int do_barriers; 754 int do_barriers;
755 755
756 if (unlikely(!mddev->barriers_work && bio_barrier(bio))) {
757 bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
758 return 0;
759 }
760
761 /* 756 /*
762 * Register the new request and wait if the reconstruction 757 * Register the new request and wait if the reconstruction
763 * thread has put up a bar for new requests. 758 * thread has put up a bar for new requests.
764 * Continue immediately if no resync is active currently. 759 * Continue immediately if no resync is active currently.
760 * We test barriers_work *after* md_write_start as md_write_start
761 * may cause the first superblock write, and that will check out
762 * if barriers work.
765 */ 763 */
764
766 md_write_start(mddev, bio); /* wait on superblock update early */ 765 md_write_start(mddev, bio); /* wait on superblock update early */
767 766
767 if (unlikely(!mddev->barriers_work && bio_barrier(bio))) {
768 if (rw == WRITE)
769 md_write_end(mddev);
770 bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
771 return 0;
772 }
773
768 wait_barrier(conf); 774 wait_barrier(conf);
769 775
770 disk_stat_inc(mddev->gendisk, ios[rw]); 776 disk_stat_inc(mddev->gendisk, ios[rw]);