diff options
author | Oleg Drokin <green@linuxhacker.ru> | 2015-05-21 15:31:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-31 10:50:19 +0900 |
commit | 61d4a2e4b061179512fd4b240024a14646bb7b09 (patch) | |
tree | 054922f142b229e1f65c3d2d925a4ed1b7df81a2 /drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | |
parent | 0f53c823f9664683ce1aadab2d6a4cee950d6f62 (diff) | |
download | op-kernel-dev-61d4a2e4b061179512fd4b240024a14646bb7b09.zip op-kernel-dev-61d4a2e4b061179512fd4b240024a14646bb7b09.tar.gz |
staging/lustre/ldlm: move namespaces/resource_count to sysfs
Move ldlm display of resource_count 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.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index ad3e0b3..f88b189 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -150,9 +150,11 @@ void ldlm_proc_cleanup(void) ldlm_ns_proc_dir = NULL; } -static int lprocfs_ns_resources_seq_show(struct seq_file *m, void *v) +static ssize_t resource_count_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); __u64 res = 0; struct cfs_hash_bd bd; int i; @@ -160,9 +162,9 @@ static int lprocfs_ns_resources_seq_show(struct seq_file *m, void *v) /* result is not strictly consistent */ cfs_hash_for_each_bucket(ns->ns_rs_hash, &bd, i) res += cfs_hash_bd_count_get(&bd); - return lprocfs_rd_u64(m, &res); + return sprintf(buf, "%lld\n", res); } -LPROC_SEQ_FOPS_RO(lprocfs_ns_resources); +LUSTRE_RO_ATTR(resource_count); static int lprocfs_ns_locks_seq_show(struct seq_file *m, void *v) { @@ -305,6 +307,7 @@ LPROC_SEQ_FOPS(lprocfs_elc); /* These are for namespaces in /sys/fs/lustre/ldlm/namespaces/ */ static struct attribute *ldlm_ns_attrs[] = { + &lustre_attr_resource_count.attr, NULL, }; @@ -390,7 +393,6 @@ int ldlm_namespace_proc_register(struct ldlm_namespace *ns) memset(lock_vars, 0, sizeof(lock_vars)); lock_vars[0].name = lock_name; - LDLM_NS_ADD_VAR("resource_count", ns, &lprocfs_ns_resources_fops); LDLM_NS_ADD_VAR("lock_count", ns, &lprocfs_ns_locks_fops); if (ns_is_client(ns)) { |