static int lprocfs_ns_resources_seq_show(struct seq_file *m, void *v) { struct ldlm_namespace *ns = m->private; __u64 res = 0; cfs_hash_bd_t bd; int i; /* result is not strictly consistant */ cfs_hash_for_each_bucket(ns->ns_rs_hash, &bd, i) res += cfs_hash_bd_count_get(&bd); return lprocfs_rd_u64(m, &res); }
static int lprocfs_rd_ns_resources(char *page, char **start, off_t off, int count, int *eof, void *data) { struct ldlm_namespace *ns = data; __u64 res = 0; cfs_hash_bd_t bd; int i; /* result is not strictly consistant */ cfs_hash_for_each_bucket(ns->ns_rs_hash, &bd, i) res += cfs_hash_bd_count_get(&bd); return lprocfs_rd_u64(page, start, off, count, eof, &res); }
static ssize_t resource_count_show(struct kobject *kobj, struct attribute *attr, char *buf) { struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); __u64 res = 0; struct cfs_hash_bd bd; int i; /* result is not strictly consistent */ cfs_hash_for_each_bucket(ns->ns_rs_hash, &bd, i) res += cfs_hash_bd_count_get(&bd); return sprintf(buf, "%lld\n", res); }