Commit 6784096b authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/ldlm: move namespaces/lru_size to sysfs

Move ldlm display of lru_size from procfs to sysfs
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 63af1f57
...@@ -179,31 +179,28 @@ static ssize_t lock_count_show(struct kobject *kobj, struct attribute *attr, ...@@ -179,31 +179,28 @@ static ssize_t lock_count_show(struct kobject *kobj, struct attribute *attr,
} }
LUSTRE_RO_ATTR(lock_count); LUSTRE_RO_ATTR(lock_count);
static int lprocfs_lru_size_seq_show(struct seq_file *m, void *v) static ssize_t lru_size_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{ {
struct ldlm_namespace *ns = m->private; struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
ns_kobj);
__u32 *nr = &ns->ns_max_unused; __u32 *nr = &ns->ns_max_unused;
if (ns_connect_lru_resize(ns)) if (ns_connect_lru_resize(ns))
nr = &ns->ns_nr_unused; nr = &ns->ns_nr_unused;
return lprocfs_rd_uint(m, nr); return sprintf(buf, "%u", *nr);
} }
static ssize_t lprocfs_lru_size_seq_write(struct file *file, static ssize_t lru_size_store(struct kobject *kobj, struct attribute *attr,
const char __user *buffer, const char *buffer, size_t count)
size_t count, loff_t *off)
{ {
struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private; struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
char dummy[MAX_STRING_SIZE + 1]; ns_kobj);
unsigned long tmp; unsigned long tmp;
int lru_resize; int lru_resize;
int err; int err;
dummy[MAX_STRING_SIZE] = '\0'; if (strncmp(buffer, "clear", 5) == 0) {
if (copy_from_user(dummy, buffer, MAX_STRING_SIZE))
return -EFAULT;
if (strncmp(dummy, "clear", 5) == 0) {
CDEBUG(D_DLMTRACE, CDEBUG(D_DLMTRACE,
"dropping all unused locks from namespace %s\n", "dropping all unused locks from namespace %s\n",
ldlm_ns_name(ns)); ldlm_ns_name(ns));
...@@ -229,9 +226,9 @@ static ssize_t lprocfs_lru_size_seq_write(struct file *file, ...@@ -229,9 +226,9 @@ static ssize_t lprocfs_lru_size_seq_write(struct file *file,
return count; return count;
} }
err = kstrtoul(dummy, 10, &tmp); err = kstrtoul(buffer, 10, &tmp);
if (err != 0) { if (err != 0) {
CERROR("invalid value written\n"); CERROR("lru_size: invalid value written\n");
return -EINVAL; return -EINVAL;
} }
lru_resize = (tmp == 0); lru_resize = (tmp == 0);
...@@ -277,7 +274,7 @@ static ssize_t lprocfs_lru_size_seq_write(struct file *file, ...@@ -277,7 +274,7 @@ static ssize_t lprocfs_lru_size_seq_write(struct file *file,
return count; return count;
} }
LPROC_SEQ_FOPS(lprocfs_lru_size); LUSTRE_RW_ATTR(lru_size);
static int lprocfs_elc_seq_show(struct seq_file *m, void *v) static int lprocfs_elc_seq_show(struct seq_file *m, void *v)
{ {
...@@ -311,6 +308,7 @@ LPROC_SEQ_FOPS(lprocfs_elc); ...@@ -311,6 +308,7 @@ LPROC_SEQ_FOPS(lprocfs_elc);
static struct attribute *ldlm_ns_attrs[] = { static struct attribute *ldlm_ns_attrs[] = {
&lustre_attr_resource_count.attr, &lustre_attr_resource_count.attr,
&lustre_attr_lock_count.attr, &lustre_attr_lock_count.attr,
&lustre_attr_lru_size.attr,
NULL, NULL,
}; };
...@@ -401,7 +399,6 @@ int ldlm_namespace_proc_register(struct ldlm_namespace *ns) ...@@ -401,7 +399,6 @@ int ldlm_namespace_proc_register(struct ldlm_namespace *ns)
if (ns_is_client(ns)) { if (ns_is_client(ns)) {
LDLM_NS_ADD_VAR("lock_unused_count", &ns->ns_nr_unused, LDLM_NS_ADD_VAR("lock_unused_count", &ns->ns_nr_unused,
&ldlm_uint_fops); &ldlm_uint_fops);
LDLM_NS_ADD_VAR("lru_size", ns, &lprocfs_lru_size_fops);
LDLM_NS_ADD_VAR("lru_max_age", &ns->ns_max_age, LDLM_NS_ADD_VAR("lru_max_age", &ns->ns_max_age,
&ldlm_rw_uint_fops); &ldlm_rw_uint_fops);
LDLM_NS_ADD_VAR("early_lock_cancel", ns, &lprocfs_elc_fops); LDLM_NS_ADD_VAR("early_lock_cancel", ns, &lprocfs_elc_fops);
......
...@@ -213,3 +213,12 @@ Date: May 2015 ...@@ -213,3 +213,12 @@ Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com> Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description: Description:
Displays number or locks allocated in this namespace. Displays number or locks allocated in this namespace.
What: /sys/fs/lustre/ldlm/namespaces/<name>/lru_size
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Controls and displays LRU size limit for unused locks for this
namespace.
0 - LRU size is unlimited, controlled by server resources
positive number - number of locks to allow in lock LRU list
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment