* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
int osc_object_is_contended(struct osc_object *obj)
{
- struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev);
- int osc_contention_time = dev->od_contention_time;
- cfs_time_t cur_time = cfs_time_current();
- cfs_time_t retry_time;
+ struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev);
+ time64_t osc_contention_time = dev->od_contention_time;
+ ktime_t retry_time;
if (OBD_FAIL_CHECK(OBD_FAIL_OSC_OBJECT_CONTENTION))
return 1;
if (!obj->oo_contended)
return 0;
- /*
- * I like copy-paste. the code is copied from
- * ll_file_is_contended.
- */
- retry_time = cfs_time_add(obj->oo_contention_time,
- cfs_time_seconds(osc_contention_time));
- if (cfs_time_after(cur_time, retry_time)) {
- osc_object_clear_contended(obj);
- return 0;
- }
- return 1;
+ /*
+ * I like copy-paste. the code is copied from
+ * ll_file_is_contended.
+ */
+ retry_time = ktime_add_ns(obj->oo_contention_time,
+ osc_contention_time * NSEC_PER_SEC);
+ if (ktime_after(ktime_get(), retry_time)) {
+ osc_object_clear_contended(obj);
+ return 0;
+ }
+ return 1;
}
EXPORT_SYMBOL(osc_object_is_contended);