summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
diff options
context:
space:
mode:
authorOleg Drokin <green@linuxhacker.ru>2015-05-21 15:32:05 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-31 10:50:20 +0900
commit24b8c88a7122df35ce6a413cd76e9581411eab8f (patch)
treefde19504332ba177d160719afa75a17ef5b46fad /drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
parentf2825e039e1a6b58411087e1e17638f872d00a93 (diff)
downloadop-kernel-dev-24b8c88a7122df35ce6a413cd76e9581411eab8f.zip
op-kernel-dev-24b8c88a7122df35ce6a413cd76e9581411eab8f.tar.gz
staging/lustre/ldlm: move procfs ldlm pool stats to sysfs
Suitable contents of /proc/fs/lustre/ldlm/namespaces/.../pools/ is moved to /sys/fs/lustre/ldlm/namespaces/.../pools/: cancel_rate grant_plan grant_speed lock_volume_factor server_lock_volume granted grant_rate limit recalc_period 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_internal.h')
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_internal.h73
1 files changed, 59 insertions, 14 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
index 70b909f..636451d 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
@@ -238,40 +238,85 @@ enum ldlm_policy_res {
typedef enum ldlm_policy_res ldlm_policy_res_t;
-#define LDLM_POOL_PROC_READER_SEQ_SHOW(var, type) \
- static int lprocfs_##var##_seq_show(struct seq_file *m, void *v) \
+#define LDLM_POOL_SYSFS_PRINT_int(v) sprintf(buf, "%d\n", v)
+#define LDLM_POOL_SYSFS_SET_int(a, b) { a = b; }
+#define LDLM_POOL_SYSFS_PRINT_u64(v) sprintf(buf, "%lld\n", v)
+#define LDLM_POOL_SYSFS_SET_u64(a, b) { a = b; }
+#define LDLM_POOL_SYSFS_PRINT_atomic(v) sprintf(buf, "%d\n", atomic_read(&v))
+#define LDLM_POOL_SYSFS_SET_atomic(a, b) atomic_set(&a, b)
+
+#define LDLM_POOL_SYSFS_READER_SHOW(var, type) \
+ static ssize_t var##_show(struct kobject *kobj, \
+ struct attribute *attr, \
+ char *buf) \
{ \
- struct ldlm_pool *pl = m->private; \
+ struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, \
+ pl_kobj); \
type tmp; \
\
spin_lock(&pl->pl_lock); \
tmp = pl->pl_##var; \
spin_unlock(&pl->pl_lock); \
\
- return lprocfs_rd_uint(m, &tmp); \
+ return LDLM_POOL_SYSFS_PRINT_##type(tmp); \
} \
struct __##var##__dummy_read {; } /* semicolon catcher */
-#define LDLM_POOL_PROC_WRITER(var, type) \
- static int lprocfs_wr_##var(struct file *file, \
- const char __user *buffer, \
- unsigned long count, void *data) \
+#define LDLM_POOL_SYSFS_WRITER_STORE(var, type) \
+ static ssize_t var##_store(struct kobject *kobj, \
+ struct attribute *attr, \
+ const char *buffer, \
+ unsigned long count) \
{ \
- struct ldlm_pool *pl = data; \
- type tmp; \
+ struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, \
+ pl_kobj); \
+ unsigned long tmp; \
int rc; \
\
- rc = lprocfs_wr_uint(file, buffer, count, &tmp); \
+ rc = kstrtoul(buffer, 10, &tmp); \
if (rc < 0) { \
- CERROR("Can't parse user input, rc = %d\n", rc); \
return rc; \
} \
\
spin_lock(&pl->pl_lock); \
- pl->pl_##var = tmp; \
+ LDLM_POOL_SYSFS_SET_##type(pl->pl_##var, tmp); \
spin_unlock(&pl->pl_lock); \
\
- return rc; \
+ return count; \
+ } \
+ struct __##var##__dummy_write {; } /* semicolon catcher */
+
+#define LDLM_POOL_SYSFS_READER_NOLOCK_SHOW(var, type) \
+ static ssize_t var##_show(struct kobject *kobj, \
+ struct attribute *attr, \
+ char *buf) \
+ { \
+ struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, \
+ pl_kobj); \
+ \
+ return LDLM_POOL_SYSFS_PRINT_##type(pl->pl_##var); \
+ } \
+ struct __##var##__dummy_read {; } /* semicolon catcher */
+
+#define LDLM_POOL_SYSFS_WRITER_NOLOCK_STORE(var, type) \
+ static ssize_t var##_store(struct kobject *kobj, \
+ struct attribute *attr, \
+ const char *buffer, \
+ unsigned long count) \
+ { \
+ struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, \
+ pl_kobj); \
+ unsigned long tmp; \
+ int rc; \
+ \
+ rc = kstrtoul(buffer, 10, &tmp); \
+ if (rc < 0) { \
+ return rc; \
+ } \
+ \
+ LDLM_POOL_SYSFS_SET_##type(pl->pl_##var, tmp); \
+ \
+ return count; \
} \
struct __##var##__dummy_write {; } /* semicolon catcher */
OpenPOWER on IntegriCloud