diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-06-17 17:33:10 +0200 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-07-19 20:00:47 +0200 |
commit | 0e3ef49eda5bae3aa75aa8c0276411bf0f27e03a (patch) | |
tree | 7c4a99c0ef5930b3380aa01bf754066d11b0ab2a /drivers/md/raid10.c | |
parent | md: reduce the number of synchronize_rcu() calls when multiple devices fail. (diff) | |
download | linux-0e3ef49eda5bae3aa75aa8c0276411bf0f27e03a.tar.xz linux-0e3ef49eda5bae3aa75aa8c0276411bf0f27e03a.zip |
md: use seconds granularity for error logging
The md code stores the exact time of the last error in the
last_read_error variable using a timespec structure. It only
ever uses the seconds portion of that though, so we can
use a scalar for it.
There won't be an overflow in 2038 here, because it already
used monotonic time and 32-bit is enough for that, but I've
decided to use time64_t for consistency in the conversion.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8ee5d96e6a2d..f7f3c8a63419 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2174,21 +2174,20 @@ static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio) */ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev) { - struct timespec cur_time_mon; + long cur_time_mon; unsigned long hours_since_last; unsigned int read_errors = atomic_read(&rdev->read_errors); - ktime_get_ts(&cur_time_mon); + cur_time_mon = ktime_get_seconds(); - if (rdev->last_read_error.tv_sec == 0 && - rdev->last_read_error.tv_nsec == 0) { + if (rdev->last_read_error == 0) { /* first time we've seen a read error */ rdev->last_read_error = cur_time_mon; return; } - hours_since_last = (cur_time_mon.tv_sec - - rdev->last_read_error.tv_sec) / 3600; + hours_since_last = (long)(cur_time_mon - + rdev->last_read_error) / 3600; rdev->last_read_error = cur_time_mon; |