struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
ns_kobj);
- return sprintf(buf, "%u\n", ns->ns_max_age);
+ return sprintf(buf, "%lld\n", ktime_to_ms(ns->ns_max_age));
}
static ssize_t lru_max_age_store(struct kobject *kobj, struct attribute *attr,
{
struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
ns_kobj);
- unsigned long tmp;
+ int scale = NSEC_PER_MSEC;
+ unsigned long long tmp;
+ char *buf;
int err;
- err = kstrtoul(buffer, 10, &tmp);
+ /* Did the user ask in seconds or milliseconds. Default is in ms */
+ buf = strstr(buffer, "ms");
+ if (!buf) {
+ buf = strchr(buffer, 's');
+ if (buf)
+ scale = NSEC_PER_SEC;
+ }
+
+ if (buf)
+ *buf = '\0';
+
+ err = kstrtoull(buffer, 10, &tmp);
if (err != 0)
return -EINVAL;
- ns->ns_max_age = tmp;
+ ns->ns_max_age = ktime_set(0, tmp * scale);
return count;
}
ns->ns_max_parallel_ast = LDLM_DEFAULT_PARALLEL_AST_LIMIT;
ns->ns_nr_unused = 0;
ns->ns_max_unused = LDLM_DEFAULT_LRU_SIZE;
- ns->ns_max_age = LDLM_DEFAULT_MAX_ALIVE;
+ ns->ns_max_age = ktime_set(LDLM_DEFAULT_MAX_ALIVE, 0);
ns->ns_ctime_age_limit = LDLM_CTIME_AGE_LIMIT;
ns->ns_timeouts = 0;
ns->ns_orig_connect_flags = 0;