aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_sysfs.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
index 88361d76f73a..9835139ce1ec 100644
--- a/fs/xfs/xfs_sysfs.c
+++ b/fs/xfs/xfs_sysfs.c
@@ -53,7 +53,71 @@ struct kobj_type xfs_mp_ktype = {
53 53
54/* xlog */ 54/* xlog */
55 55
56STATIC ssize_t
57log_head_lsn_show(
58 char *buf,
59 void *data)
60{
61 struct xlog *log = data;
62 int cycle;
63 int block;
64
65 spin_lock(&log->l_icloglock);
66 cycle = log->l_curr_cycle;
67 block = log->l_curr_block;
68 spin_unlock(&log->l_icloglock);
69
70 return snprintf(buf, PAGE_SIZE, "%d:%d\n", cycle, block);
71}
72XFS_SYSFS_ATTR_RO(log_head_lsn);
73
74STATIC ssize_t
75log_tail_lsn_show(
76 char *buf,
77 void *data)
78{
79 struct xlog *log = data;
80 int cycle;
81 int block;
82
83 xlog_crack_atomic_lsn(&log->l_tail_lsn, &cycle, &block);
84 return snprintf(buf, PAGE_SIZE, "%d:%d\n", cycle, block);
85}
86XFS_SYSFS_ATTR_RO(log_tail_lsn);
87
88STATIC ssize_t
89reserve_grant_head_show(
90 char *buf,
91 void *data)
92{
93 struct xlog *log = data;
94 int cycle;
95 int bytes;
96
97 xlog_crack_grant_head(&log->l_reserve_head.grant, &cycle, &bytes);
98 return snprintf(buf, PAGE_SIZE, "%d:%d\n", cycle, bytes);
99}
100XFS_SYSFS_ATTR_RO(reserve_grant_head);
101
102STATIC ssize_t
103write_grant_head_show(
104 char *buf,
105 void *data)
106{
107 struct xlog *log = data;
108 int cycle;
109 int bytes;
110
111 xlog_crack_grant_head(&log->l_write_head.grant, &cycle, &bytes);
112 return snprintf(buf, PAGE_SIZE, "%d:%d\n", cycle, bytes);
113}
114XFS_SYSFS_ATTR_RO(write_grant_head);
115
56static struct attribute *xfs_log_attrs[] = { 116static struct attribute *xfs_log_attrs[] = {
117 ATTR_LIST(log_head_lsn),
118 ATTR_LIST(log_tail_lsn),
119 ATTR_LIST(reserve_grant_head),
120 ATTR_LIST(write_grant_head),
57 NULL, 121 NULL,
58}; 122};
59 123