diff options
author | NeilBrown <neilb@suse.com> | 2018-03-29 15:26:48 +1100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-23 14:52:51 +0200 |
commit | b0fdb5702533eda27357102ff221297fe5cf009b (patch) | |
tree | 582b70ae5a9b1d94499389637c9a13f65a151d92 /drivers/staging/lustre/lustre/ldlm | |
parent | 4671dc9f97bca650708ea3b304bb952c3b767b6a (diff) | |
download | op-kernel-dev-b0fdb5702533eda27357102ff221297fe5cf009b.zip op-kernel-dev-b0fdb5702533eda27357102ff221297fe5cf009b.tar.gz |
staging: lustre: libcfs: discard cfs_time_add/sub
cfs_time_add adds its arguments.
cfs_time_sub subtracts finds the difference.
Discard these and use '+' and '-' directly.
This change highlighted a type error. The structure field
cr_queued_time was used to store jiffies, but was declared
as time_t (meant for seconds). So the time is changed to
"unsigned long".
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
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_lockd.c | 3 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 8 |
2 files changed, 4 insertions, 7 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index ab4dd15..150e78c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -326,8 +326,7 @@ static void ldlm_handle_gl_callback(struct ptlrpc_request *req, if (lock->l_granted_mode == LCK_PW && !lock->l_readers && !lock->l_writers && cfs_time_after(jiffies, - cfs_time_add(lock->l_last_used, - 10 * HZ))) { + lock->l_last_used + 10 * HZ)) { unlock_res_and_lock(lock); if (ldlm_bl_to_thread_lock(ns, NULL, lock)) ldlm_handle_bl_callback(ns, NULL, lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 0e1b21c..6eb42f1 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -1176,13 +1176,12 @@ static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, * Despite of the LV, It doesn't make sense to keep the lock which * is unused for ns_max_age time. */ - if (cfs_time_after(jiffies, - cfs_time_add(lock->l_last_used, ns->ns_max_age))) + if (cfs_time_after(jiffies, lock->l_last_used + ns->ns_max_age)) return LDLM_POLICY_CANCEL_LOCK; slv = ldlm_pool_get_slv(pl); lvf = ldlm_pool_get_lvf(pl); - la = cfs_duration_sec(cfs_time_sub(cur, lock->l_last_used)); + la = cfs_duration_sec(cur - lock->l_last_used); lv = lvf * la * unused; /* Inform pool about current CLV to see it via debugfs. */ @@ -1233,8 +1232,7 @@ static enum ldlm_policy_res ldlm_cancel_aged_policy(struct ldlm_namespace *ns, int count) { if ((added >= count) && - time_before(jiffies, - cfs_time_add(lock->l_last_used, ns->ns_max_age))) + time_before(jiffies, lock->l_last_used + ns->ns_max_age)) return LDLM_POLICY_KEEP_LOCK; return LDLM_POLICY_CANCEL_LOCK; |