aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
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
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')
-rw-r--r--drivers/md/raid1.c13
-rw-r--r--drivers/md/raid10.c11
2 files changed, 17 insertions, 7 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);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index f0141910bb8d..a9401c017e35 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -782,6 +782,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
782 int i; 782 int i;
783 int chunk_sects = conf->chunk_mask + 1; 783 int chunk_sects = conf->chunk_mask + 1;
784 const int rw = bio_data_dir(bio); 784 const int rw = bio_data_dir(bio);
785 const int do_sync = bio_sync(bio);
785 struct bio_list bl; 786 struct bio_list bl;
786 unsigned long flags; 787 unsigned long flags;
787 788
@@ -863,7 +864,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
863 mirror->rdev->data_offset; 864 mirror->rdev->data_offset;
864 read_bio->bi_bdev = mirror->rdev->bdev; 865 read_bio->bi_bdev = mirror->rdev->bdev;
865 read_bio->bi_end_io = raid10_end_read_request; 866 read_bio->bi_end_io = raid10_end_read_request;
866 read_bio->bi_rw = READ; 867 read_bio->bi_rw = READ | do_sync;
867 read_bio->bi_private = r10_bio; 868 read_bio->bi_private = r10_bio;
868 869
869 generic_make_request(read_bio); 870 generic_make_request(read_bio);
@@ -909,7 +910,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
909 conf->mirrors[d].rdev->data_offset; 910 conf->mirrors[d].rdev->data_offset;
910 mbio->bi_bdev = conf->mirrors[d].rdev->bdev; 911 mbio->bi_bdev = conf->mirrors[d].rdev->bdev;
911 mbio->bi_end_io = raid10_end_write_request; 912 mbio->bi_end_io = raid10_end_write_request;
912 mbio->bi_rw = WRITE; 913 mbio->bi_rw = WRITE | do_sync;
913 mbio->bi_private = r10_bio; 914 mbio->bi_private = r10_bio;
914 915
915 atomic_inc(&r10_bio->remaining); 916 atomic_inc(&r10_bio->remaining);
@@ -922,6 +923,9 @@ static int make_request(request_queue_t *q, struct bio * bio)
922 blk_plug_device(mddev->queue); 923 blk_plug_device(mddev->queue);
923 spin_unlock_irqrestore(&conf->device_lock, flags); 924 spin_unlock_irqrestore(&conf->device_lock, flags);
924 925
926 if (do_sync)
927 md_wakeup_thread(mddev->thread);
928
925 return 0; 929 return 0;
926} 930}
927 931
@@ -1563,6 +1567,7 @@ static void raid10d(mddev_t *mddev)
1563 (unsigned long long)r10_bio->sector); 1567 (unsigned long long)r10_bio->sector);
1564 raid_end_bio_io(r10_bio); 1568 raid_end_bio_io(r10_bio);
1565 } else { 1569 } else {
1570 const int do_sync = bio_sync(r10_bio->master_bio);
1566 rdev = conf->mirrors[mirror].rdev; 1571 rdev = conf->mirrors[mirror].rdev;
1567 if (printk_ratelimit()) 1572 if (printk_ratelimit())
1568 printk(KERN_ERR "raid10: %s: redirecting sector %llu to" 1573 printk(KERN_ERR "raid10: %s: redirecting sector %llu to"
@@ -1574,7 +1579,7 @@ static void raid10d(mddev_t *mddev)
1574 bio->bi_sector = r10_bio->devs[r10_bio->read_slot].addr 1579 bio->bi_sector = r10_bio->devs[r10_bio->read_slot].addr
1575 + rdev->data_offset; 1580 + rdev->data_offset;
1576 bio->bi_bdev = rdev->bdev; 1581 bio->bi_bdev = rdev->bdev;
1577 bio->bi_rw = READ; 1582 bio->bi_rw = READ | do_sync;
1578 bio->bi_private = r10_bio; 1583 bio->bi_private = r10_bio;
1579 bio->bi_end_io = raid10_end_read_request; 1584 bio->bi_end_io = raid10_end_read_request;
1580 unplug = 1; 1585 unplug = 1;