X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fldlm%2Fldlm_resource.c;h=31ee70412e8fb3d0547b5bae4284bccd467aca91;hb=800ffd4711863e1067a693f1283bccf4edddf2a2;hp=5cb58f59fea7cdc65513c33b8298d669eb82f0dd;hpb=21ea1f7629535090d64ee3355c491a9e35256f23;p=fs%2Flustre-release.git diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index 5cb58f5..31ee704 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -407,7 +407,7 @@ static ssize_t lru_max_age_show(struct kobject *kobj, struct attribute *attr, 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, @@ -415,14 +415,27 @@ 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; } @@ -940,7 +953,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, 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;