Commit eea1bf3
committed
md: Fix is_mddev_idle test (again).
There are two problems with is_mddev_idle.
1/ sync_io is 'atomic_t' and hence 'int'. curr_events and all the
rest are 'long'.
So if sync_io were to wrap on a 64bit host, the value of
curr_events would go very negative suddenly, and take a very
long time to return to positive.
So do all calculations as 'int'. That gives us plenty of precision
for what we need.
2/ To initialise rdev->last_events we simply call is_mddev_idle, on
the assumption that it will make sure that last_events is in a
suitable range. It used to do this, but now it does not.
So now we need to be more explicit about initialisation.
Signed-off-by: NeilBrown <neilb@suse.de>1 parent 99adcd9 commit eea1bf3
2 files changed
+9
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5716 | 5716 | | |
5717 | 5717 | | |
5718 | 5718 | | |
5719 | | - | |
| 5719 | + | |
5720 | 5720 | | |
5721 | 5721 | | |
5722 | 5722 | | |
5723 | | - | |
| 5723 | + | |
5724 | 5724 | | |
5725 | 5725 | | |
5726 | 5726 | | |
5727 | 5727 | | |
5728 | 5728 | | |
5729 | | - | |
5730 | | - | |
5731 | | - | |
| 5729 | + | |
| 5730 | + | |
| 5731 | + | |
5732 | 5732 | | |
5733 | 5733 | | |
5734 | 5734 | | |
| |||
5751 | 5751 | | |
5752 | 5752 | | |
5753 | 5753 | | |
5754 | | - | |
| 5754 | + | |
5755 | 5755 | | |
5756 | 5756 | | |
5757 | 5757 | | |
| |||
5994 | 5994 | | |
5995 | 5995 | | |
5996 | 5996 | | |
5997 | | - | |
| 5997 | + | |
5998 | 5998 | | |
5999 | 5999 | | |
6000 | 6000 | | |
| |||
6096 | 6096 | | |
6097 | 6097 | | |
6098 | 6098 | | |
6099 | | - | |
| 6099 | + | |
6100 | 6100 | | |
6101 | 6101 | | |
6102 | 6102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
0 commit comments