diff options
author | NeilBrown <neilb@suse.de> | 2007-05-11 01:23:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 11:29:37 -0400 |
commit | 435b71be20f2ad3688acd94c05e968e029464d60 (patch) | |
tree | fdc4b08074f148298cecd6915c6427353652b0ba /drivers/md/md.c | |
parent | 11fe250d89cdce3d6bb43bd674f3dcdcaa78dbc8 (diff) |
md: improve the is_mddev_idle test
During a 'resync' or similar activity, md checks if the devices in the
array are otherwise active and winds back resync activity when they are.
This test in done in is_mddev_idle, and it is somewhat fragile - it
sometimes thinks there is non-sync io when there isn't.
The test compares the total sectors of io (disk_stat_read) with the sectors
of resync io (disk->sync_io). This has problems because total sectors gets
updated when a request completes, while resync io gets updated when the
request is submitted. The time difference can cause large differenced
between the two which do not actually imply non-resync activity. The test
currently allows for some fuzz (+/- 4096) but there are some cases when it
is not enough.
The test currently looks for any (non-fuzz) difference, either positive or
negative. This clearly is not needed. Any non-sync activity will cause
the total sectors to grow faster than the sync_io count (never slower) so
we only need to look for a positive differences.
If we do this then the amount of in-flight sync io will never cause the
appearance of non-sync IO. Once enough non-sync IO to worry about starts
happening, resync will be slowed down and the measurements will thus be
more precise (as there is less in-flight) and control of resync will still
be suitably responsive.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 65814b0340cb..c10ce91b64e9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5103,7 +5103,7 @@ static int is_mddev_idle(mddev_t *mddev) | |||
5103 | * | 5103 | * |
5104 | * Note: the following is an unsigned comparison. | 5104 | * Note: the following is an unsigned comparison. |
5105 | */ | 5105 | */ |
5106 | if ((curr_events - rdev->last_events + 4096) > 8192) { | 5106 | if ((long)curr_events - (long)rdev->last_events > 4096) { |
5107 | rdev->last_events = curr_events; | 5107 | rdev->last_events = curr_events; |
5108 | idle = 0; | 5108 | idle = 0; |
5109 | } | 5109 | } |