aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorLars Ellenberg <Lars.Ellenberg@linbit.com>2007-01-11 02:15:37 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2007-01-11 21:18:21 -0500
commite3881a6816b45668df60a426e5c3431ece1539a7 (patch)
tree617032a76e25e7167b95ebe4c4a6c90ee301c4c6 /drivers/md/raid1.c
parent664c0d3d575946bce24ecf5b7f93ee9541e4caf3 (diff)
[PATCH] md: pass down BIO_RW_SYNC in raid{1,10}
md raidX make_request functions strip off the BIO_RW_SYNC flag, thus introducing additional latency. Fixing this in raid1 and raid10 seems to be straightforward enough. For our particular usage case in DRBD, passing this flag improved some initialization time from ~5 minutes to ~5 seconds. Acked-by: NeilBrown <neilb@suse.de> Signed-off-by: Lars Ellenberg <lars@linbit.com> Acked-by: Jens Axboe <jens.axboe@oracle.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index b30f74be3982..164b25dca101 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -775,6 +775,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
775 struct bio_list bl; 775 struct bio_list bl;
776 struct page **behind_pages = NULL; 776 struct page **behind_pages = NULL;
777 const int rw = bio_data_dir(bio); 777 const int rw = bio_data_dir(bio);
778 const int do_sync = bio_sync(bio);
778 int do_barriers; 779 int do_barriers;
779 780
780 /* 781 /*
@@ -835,7 +836,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
835 read_bio->bi_sector = r1_bio->sector + mirror->rdev->data_offset; 836 read_bio->bi_sector = r1_bio->sector + mirror->rdev->data_offset;
836 read_bio->bi_bdev = mirror->rdev->bdev; 837 read_bio->bi_bdev = mirror->rdev->bdev;
837 read_bio->bi_end_io = raid1_end_read_request; 838 read_bio->bi_end_io = raid1_end_read_request;
838 read_bio->bi_rw = READ; 839 read_bio->bi_rw = READ | do_sync;
839 read_bio->bi_private = r1_bio; 840 read_bio->bi_private = r1_bio;
840 841
841 generic_make_request(read_bio); 842 generic_make_request(read_bio);
@@ -906,7 +907,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
906 mbio->bi_sector = r1_bio->sector + conf->mirrors[i].rdev->data_offset; 907 mbio->bi_sector = r1_bio->sector + conf->mirrors[i].rdev->data_offset;
907 mbio->bi_bdev = conf->mirrors[i].rdev->bdev; 908 mbio->bi_bdev = conf->mirrors[i].rdev->bdev;
908 mbio->bi_end_io = raid1_end_write_request; 909 mbio->bi_end_io = raid1_end_write_request;
909 mbio->bi_rw = WRITE | do_barriers; 910 mbio->bi_rw = WRITE | do_barriers | do_sync;
910 mbio->bi_private = r1_bio; 911 mbio->bi_private = r1_bio;
911 912
912 if (behind_pages) { 913 if (behind_pages) {
@@ -941,6 +942,8 @@ static int make_request(request_queue_t *q, struct bio * bio)
941 blk_plug_device(mddev->queue); 942 blk_plug_device(mddev->queue);
942 spin_unlock_irqrestore(&conf->device_lock, flags); 943 spin_unlock_irqrestore(&conf->device_lock, flags);
943 944
945 if (do_sync)
946 md_wakeup_thread(mddev->thread);
944#if 0 947#if 0
945 while ((bio = bio_list_pop(&bl)) != NULL) 948 while ((bio = bio_list_pop(&bl)) != NULL)
946 generic_make_request(bio); 949 generic_make_request(bio);
@@ -1541,6 +1544,7 @@ static void raid1d(mddev_t *mddev)
1541 * We already have a nr_pending reference on these rdevs. 1544 * We already have a nr_pending reference on these rdevs.
1542 */ 1545 */
1543 int i; 1546 int i;
1547 const int do_sync = bio_sync(r1_bio->master_bio);
1544 clear_bit(R1BIO_BarrierRetry, &r1_bio->state); 1548 clear_bit(R1BIO_BarrierRetry, &r1_bio->state);
1545 clear_bit(R1BIO_Barrier, &r1_bio->state); 1549 clear_bit(R1BIO_Barrier, &r1_bio->state);
1546 for (i=0; i < conf->raid_disks; i++) 1550 for (i=0; i < conf->raid_disks; i++)
@@ -1561,7 +1565,7 @@ static void raid1d(mddev_t *mddev)
1561 conf->mirrors[i].rdev->data_offset; 1565 conf->mirrors[i].rdev->data_offset;
1562 bio->bi_bdev = conf->mirrors[i].rdev->bdev; 1566 bio->bi_bdev = conf->mirrors[i].rdev->bdev;
1563 bio->bi_end_io = raid1_end_write_request; 1567 bio->bi_end_io = raid1_end_write_request;
1564 bio->bi_rw = WRITE; 1568 bio->bi_rw = WRITE | do_sync;
1565 bio->bi_private = r1_bio; 1569 bio->bi_private = r1_bio;
1566 r1_bio->bios[i] = bio; 1570 r1_bio->bios[i] = bio;
1567 generic_make_request(bio); 1571 generic_make_request(bio);
@@ -1593,6 +1597,7 @@ static void raid1d(mddev_t *mddev)
1593 (unsigned long long)r1_bio->sector); 1597 (unsigned long long)r1_bio->sector);
1594 raid_end_bio_io(r1_bio); 1598 raid_end_bio_io(r1_bio);
1595 } else { 1599 } else {
1600 const int do_sync = bio_sync(r1_bio->master_bio);
1596 r1_bio->bios[r1_bio->read_disk] = 1601 r1_bio->bios[r1_bio->read_disk] =
1597 mddev->ro ? IO_BLOCKED : NULL; 1602 mddev->ro ? IO_BLOCKED : NULL;
1598 r1_bio->read_disk = disk; 1603 r1_bio->read_disk = disk;
@@ -1608,7 +1613,7 @@ static void raid1d(mddev_t *mddev)
1608 bio->bi_sector = r1_bio->sector + rdev->data_offset; 1613 bio->bi_sector = r1_bio->sector + rdev->data_offset;
1609 bio->bi_bdev = rdev->bdev; 1614 bio->bi_bdev = rdev->bdev;
1610 bio->bi_end_io = raid1_end_read_request; 1615 bio->bi_end_io = raid1_end_read_request;
1611 bio->bi_rw = READ; 1616 bio->bi_rw = READ | do_sync;
1612 bio->bi_private = r1_bio; 1617 bio->bi_private = r1_bio;
1613 unplug = 1; 1618 unplug = 1;
1614 generic_make_request(bio); 1619 generic_make_request(bio);