static timeout_t pinger_check_timeout(time64_t time)
{
- timeout_t timeout = PING_INTERVAL;
- timeout_t next_timeout;
- time64_t now;
- struct list_head *iter;
- struct obd_import *imp;
-
- mutex_lock(&pinger_mutex);
- now = ktime_get_seconds();
- /* Process imports to find a nearest next ping */
- list_for_each(iter, &pinger_imports) {
- imp = list_entry(iter, struct obd_import, imp_pinger_chain);
- if (!imp->imp_pingable || imp->imp_next_ping < now)
- continue;
- next_timeout = imp->imp_next_ping - now;
- /* make sure imp_next_ping in the future from time */
- if (next_timeout > (now - time) && timeout > next_timeout)
- timeout = next_timeout;
- }
- mutex_unlock(&pinger_mutex);
+ time64_t timeout = PING_INTERVAL;
- return timeout - (now - time);
+ return time + timeout - ktime_get_seconds();
}
static bool ir_up;