int unused, int added,
int count)
{
- cfs_time_t cur = cfs_time_current();
+ ktime_t cur = ktime_get();
struct ldlm_pool *pl = &ns->ns_pool;
- __u64 slv, lvf, lv;
- cfs_time_t la;
+ u64 slv, lvf, lv;
+ s64 la;
/* Stop LRU processing when we reach past @count or have checked all
* locks in LRU. */
return LDLM_POLICY_KEEP_LOCK;
/* 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(cfs_time_current(),
- cfs_time_add(lock->l_last_used, ns->ns_max_age)))
+ * is unused for ns_max_age time.
+ */
+ if (ktime_after(ktime_get(),
+ ktime_add(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 = ktime_to_ns(ktime_sub(cur, lock->l_last_used)) / NSEC_PER_SEC;
lv = lvf * la * unused;
/* Inform pool about current CLV to see it via proc. */
int count)
{
if ((added >= count) &&
- cfs_time_before(cfs_time_current(),
- cfs_time_add(lock->l_last_used, ns->ns_max_age)))
+ ktime_before(ktime_get(),
+ ktime_add(lock->l_last_used, ns->ns_max_age)))
return LDLM_POLICY_KEEP_LOCK;
return LDLM_POLICY_CANCEL_LOCK;
while (!list_empty(&ns->ns_unused_list)) {
enum ldlm_policy_res result;
- cfs_time_t last_use = 0;
+ ktime_t last_use = ktime_set(0, 0);
/* all unused locks */
if (remained-- <= 0)
continue;
last_use = lock->l_last_used;
- if (last_use == cfs_time_current())
- continue;
/* Somebody is already doing CANCEL. No need for this
* lock in LRU, do not traverse it again. */
if (!ldlm_is_canceling(lock))
- break;
+ break;
ldlm_lock_remove_from_lru_nolock(lock);
}