diff options
author | majianpeng <majianpeng@gmail.com> | 2012-07-02 22:12:26 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-07-02 22:12:26 -0400 |
commit | 7c2c57c9a98bf5961e438a376486f95346f6b0c5 (patch) | |
tree | 6aeb5360e1a00bea6f97699c79a52314626eb9ec /drivers/md/md.c | |
parent | 1850753d2e6d9ca7856581ca5d3cf09521e6a5d7 (diff) |
md:Add blk_plug in sync_thread.
Add blk_plug in sync_thread will increase the performance of sync.
Because sync_thread did not blk_plug,so when raid sync, the bio merge
not well.
Testing environment:
SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI
Controller.
OS:Linux xxx 3.5.0-rc2+ #340 SMP Tue Jun 12 09:00:25 CST 2012
x86_64 x86_64 x86_64 GNU/Linux.
RAID5: four ST31000524NS disk.
Without blk_plug:recovery speed about 63M/Sec;
Add blk_plug:recovery speed about 120M/Sec.
Using blktrace:
blktrace -d /dev/sdb -w 60 -o -|blkparse -i -
without blk_plug:
Total (8,16):
Reads Queued: 309811, 1239MiB Writes Queued: 0, 0KiB
Read Dispatches: 283583, 1189MiB Write Dispatches: 0, 0KiB
Reads Requeued: 0 Writes Requeued: 0
Reads Completed: 273351, 1149MiB Writes Completed: 0, 0KiB
Read Merges: 23533, 94132KiB Write Merges: 0, 0KiB
IO unplugs: 0 Timer unplugs: 0
add blk_plug:
Total (8,16):
Reads Queued: 428697, 1714MiB Writes Queued: 0, 0KiB
Read Dispatches: 3954, 1714MiB Write Dispatches: 0, 0KiB
Reads Requeued: 0 Writes Requeued: 0
Reads Completed: 3956, 1715MiB Writes Completed: 0, 0KiB
Read Merges: 424743, 1698MiB Write Merges: 0, 0KiB
IO unplugs: 0 Timer unplugs: 3384
The ratio of merge will be markedly increased.
Signed-off-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1c2f9048e1ae..973aa8459e98 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7298,6 +7298,7 @@ void md_do_sync(struct mddev *mddev) | |||
7298 | int skipped = 0; | 7298 | int skipped = 0; |
7299 | struct md_rdev *rdev; | 7299 | struct md_rdev *rdev; |
7300 | char *desc; | 7300 | char *desc; |
7301 | struct blk_plug plug; | ||
7301 | 7302 | ||
7302 | /* just incase thread restarts... */ | 7303 | /* just incase thread restarts... */ |
7303 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) | 7304 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) |
@@ -7447,6 +7448,7 @@ void md_do_sync(struct mddev *mddev) | |||
7447 | } | 7448 | } |
7448 | mddev->curr_resync_completed = j; | 7449 | mddev->curr_resync_completed = j; |
7449 | 7450 | ||
7451 | blk_start_plug(&plug); | ||
7450 | while (j < max_sectors) { | 7452 | while (j < max_sectors) { |
7451 | sector_t sectors; | 7453 | sector_t sectors; |
7452 | 7454 | ||
@@ -7552,6 +7554,7 @@ void md_do_sync(struct mddev *mddev) | |||
7552 | * this also signals 'finished resyncing' to md_stop | 7554 | * this also signals 'finished resyncing' to md_stop |
7553 | */ | 7555 | */ |
7554 | out: | 7556 | out: |
7557 | blk_finish_plug(&plug); | ||
7555 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); | 7558 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); |
7556 | 7559 | ||
7557 | /* tell personality that we are finished */ | 7560 | /* tell personality that we are finished */ |