diff options
author | NeilBrown <neilb@suse.com> | 2018-02-13 08:22:36 +1100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-16 15:19:10 +0100 |
commit | 98b092804497c53ed694257dacd08f0ecc133bc9 (patch) | |
tree | 7057903d90e4c87aeabc1ef571889a716e03e3d5 /drivers/staging/lustre/lustre/ldlm | |
parent | 672b63e55bdee71150e3cc472f6294e0535a95ad (diff) | |
download | op-kernel-dev-98b092804497c53ed694257dacd08f0ecc133bc9.zip op-kernel-dev-98b092804497c53ed694257dacd08f0ecc133bc9.tar.gz |
staging: lustre: use wait_event_idle_timeout() where appropriate.
When the lwi arg has a timeout, but no timeout
callback function, l_wait_event() acts much the same as
wait_event_idle_timeout() - the wait is not interruptible and
simply waits for the event or the timeouts.
The most noticable difference is that the return value is
-ETIMEDOUT or 0, rather than 0 or non-zero.
Another difference is that if the timeout is zero, l_wait_event()
will not time out at all. In the one case where that is possible
we need to conditionally use wait_event_idle().
So replace all such calls with wait_event_idle_timeout(), being
careful of the return value.
In one case, there is no event expected, only the timeout
is needed. So use schedule_timeout_uninterruptible().
Note that the presence or absence of LWI_ON_SIGNAL_NOOP
has no effect in these cases. It only has effect if the timeout
callback is non-NULL, or the timeout is zero, or
LWI_TIMEOUT_INTR_ALL() is used.
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/ldlm')
-rw-r--r-- | drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 10 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 12 |
2 files changed, 7 insertions, 15 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 773abe7..95bea35 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1349,7 +1349,6 @@ out: if ((flags & LDLM_FL_LVB_READY) && !ldlm_is_lvb_ready(lock)) { __u64 wait_flags = LDLM_FL_LVB_READY | LDLM_FL_DESTROYED | LDLM_FL_FAIL_NOTIFIED; - struct l_wait_info lwi; if (lock->l_completion_ast) { int err = lock->l_completion_ast(lock, @@ -1366,13 +1365,10 @@ out: } } - lwi = LWI_TIMEOUT_INTR(obd_timeout * HZ, - NULL, LWI_ON_SIGNAL_NOOP, NULL); - /* XXX FIXME see comment on CAN_MATCH in lustre_dlm.h */ - l_wait_event(lock->l_waitq, - lock->l_flags & wait_flags, - &lwi); + wait_event_idle_timeout(lock->l_waitq, + lock->l_flags & wait_flags, + obd_timeout * HZ); if (!ldlm_is_lvb_ready(lock)) { if (flags & LDLM_FL_TEST_LOCK) LDLM_LOCK_RELEASE(lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 622245a..a0e486b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -997,8 +997,6 @@ static int ldlm_pools_thread_main(void *arg) "ldlm_poold", current_pid()); while (1) { - struct l_wait_info lwi; - /* * Recal all pools on this tick. */ @@ -1008,12 +1006,10 @@ static int ldlm_pools_thread_main(void *arg) * Wait until the next check time, or until we're * stopped. */ - lwi = LWI_TIMEOUT(c_time * HZ, - NULL, NULL); - l_wait_event(thread->t_ctl_waitq, - thread_is_stopping(thread) || - thread_is_event(thread), - &lwi); + wait_event_idle_timeout(thread->t_ctl_waitq, + thread_is_stopping(thread) || + thread_is_event(thread), + c_time * HZ); if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; |