summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
diff options
context:
space:
mode:
authorOleg Drokin <green@linuxhacker.ru>2015-05-21 15:32:02 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-31 10:50:19 +0900
commitc841236dda9aa334f7e241e3c526360328f77343 (patch)
tree5aea7a7c6ca17f73ad81b6e78199c14da16fb6d9 /drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
parent3dd4598271fc119a4e3c5589be03f88a41c31e64 (diff)
staging/lustre/ldlm: move namespaces/lru_max_age to sysfs
Move ldlm display of lru_max_age from procfs to sysfs Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/ldlm/ldlm_resource.c')
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_resource.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index fba09e454dce..9fab434572e7 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -287,6 +287,33 @@ static ssize_t lru_size_store(struct kobject *kobj, struct attribute *attr,
}
LUSTRE_RW_ATTR(lru_size);
+static ssize_t lru_max_age_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
+{
+ struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
+ ns_kobj);
+
+ return sprintf(buf, "%u", ns->ns_max_age);
+}
+
+static ssize_t lru_max_age_store(struct kobject *kobj, struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
+ ns_kobj);
+ unsigned long tmp;
+ int err;
+
+ err = kstrtoul(buffer, 10, &tmp);
+ if (err != 0)
+ return -EINVAL;
+
+ ns->ns_max_age = tmp;
+
+ return count;
+}
+LUSTRE_RW_ATTR(lru_max_age);
+
static ssize_t early_lock_cancel_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
@@ -325,6 +352,7 @@ static struct attribute *ldlm_ns_attrs[] = {
&lustre_attr_lock_count.attr,
&lustre_attr_lock_unused_count.attr,
&lustre_attr_lru_size.attr,
+ &lustre_attr_lru_max_age.attr,
&lustre_attr_early_lock_cancel.attr,
NULL,
};
@@ -414,8 +442,6 @@ int ldlm_namespace_proc_register(struct ldlm_namespace *ns)
lock_vars[0].name = lock_name;
if (ns_is_client(ns)) {
- LDLM_NS_ADD_VAR("lru_max_age", &ns->ns_max_age,
- &ldlm_rw_uint_fops);
} else {
LDLM_NS_ADD_VAR("ctime_age_limit", &ns->ns_ctime_age_limit,
&ldlm_rw_uint_fops);