diff options
author | Lars Ellenberg <Lars.Ellenberg@linbit.com> | 2007-01-11 02:15:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2007-01-11 21:18:21 -0500 |
commit | e3881a6816b45668df60a426e5c3431ece1539a7 (patch) | |
tree | 617032a76e25e7167b95ebe4c4a6c90ee301c4c6 /drivers/md/raid10.c | |
parent | 664c0d3d575946bce24ecf5b7f93ee9541e4caf3 (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/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 11 |
1 files changed, 8 insertions, 3 deletions
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; |