diff options
-rw-r--r-- | fs/xfs/xfs_sysfs.c | 64 |
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 | ||
56 | STATIC ssize_t | ||
57 | log_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 | } | ||
72 | XFS_SYSFS_ATTR_RO(log_head_lsn); | ||
73 | |||
74 | STATIC ssize_t | ||
75 | log_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 | } | ||
86 | XFS_SYSFS_ATTR_RO(log_tail_lsn); | ||
87 | |||
88 | STATIC ssize_t | ||
89 | reserve_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 | } | ||
100 | XFS_SYSFS_ATTR_RO(reserve_grant_head); | ||
101 | |||
102 | STATIC ssize_t | ||
103 | write_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 | } | ||
114 | XFS_SYSFS_ATTR_RO(write_grant_head); | ||
115 | |||
56 | static struct attribute *xfs_log_attrs[] = { | 116 | static 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 | ||