diff options
author | John Spray <john.spray@redhat.com> | 2014-09-12 11:58:49 -0400 |
---|---|---|
committer | Sage Weil <sage@redhat.com> | 2014-10-14 15:57:01 -0400 |
commit | 14ed97033dac4cc5fd516bfe3e37d2fc74804684 (patch) | |
tree | b77e707dd092090c909055d7b4e3342085567edc /fs | |
parent | a687ecaf50f18329206c6b78764a8c7bd30a9df0 (diff) |
ceph: additional debugfs output
MDS session state and client global ID is
useful instrumentation when testing.
Signed-off-by: John Spray <john.spray@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/debugfs.c | 46 | ||||
-rw-r--r-- | fs/ceph/super.h | 1 |
2 files changed, 47 insertions, 0 deletions
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 5a743ac141ab..5d5a4c8c8496 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
@@ -158,10 +158,47 @@ static int dentry_lru_show(struct seq_file *s, void *ptr) | |||
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | static int mds_sessions_show(struct seq_file *s, void *ptr) | ||
162 | { | ||
163 | struct ceph_fs_client *fsc = s->private; | ||
164 | struct ceph_mds_client *mdsc = fsc->mdsc; | ||
165 | struct ceph_auth_client *ac = fsc->client->monc.auth; | ||
166 | struct ceph_options *opt = fsc->client->options; | ||
167 | int mds = -1; | ||
168 | |||
169 | mutex_lock(&mdsc->mutex); | ||
170 | |||
171 | /* The 'num' portion of an 'entity name' */ | ||
172 | seq_printf(s, "global_id %llu\n", ac->global_id); | ||
173 | |||
174 | /* The -o name mount argument */ | ||
175 | seq_printf(s, "name \"%s\"\n", opt->name ? opt->name : ""); | ||
176 | |||
177 | /* The list of MDS session rank+state */ | ||
178 | for (mds = 0; mds < mdsc->max_sessions; mds++) { | ||
179 | struct ceph_mds_session *session = | ||
180 | __ceph_lookup_mds_session(mdsc, mds); | ||
181 | if (!session) { | ||
182 | continue; | ||
183 | } | ||
184 | mutex_unlock(&mdsc->mutex); | ||
185 | seq_printf(s, "mds.%d %s\n", | ||
186 | session->s_mds, | ||
187 | ceph_session_state_name(session->s_state)); | ||
188 | |||
189 | ceph_put_mds_session(session); | ||
190 | mutex_lock(&mdsc->mutex); | ||
191 | } | ||
192 | mutex_unlock(&mdsc->mutex); | ||
193 | |||
194 | return 0; | ||
195 | } | ||
196 | |||
161 | CEPH_DEFINE_SHOW_FUNC(mdsmap_show) | 197 | CEPH_DEFINE_SHOW_FUNC(mdsmap_show) |
162 | CEPH_DEFINE_SHOW_FUNC(mdsc_show) | 198 | CEPH_DEFINE_SHOW_FUNC(mdsc_show) |
163 | CEPH_DEFINE_SHOW_FUNC(caps_show) | 199 | CEPH_DEFINE_SHOW_FUNC(caps_show) |
164 | CEPH_DEFINE_SHOW_FUNC(dentry_lru_show) | 200 | CEPH_DEFINE_SHOW_FUNC(dentry_lru_show) |
201 | CEPH_DEFINE_SHOW_FUNC(mds_sessions_show) | ||
165 | 202 | ||
166 | 203 | ||
167 | /* | 204 | /* |
@@ -193,6 +230,7 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc) | |||
193 | debugfs_remove(fsc->debugfs_bdi); | 230 | debugfs_remove(fsc->debugfs_bdi); |
194 | debugfs_remove(fsc->debugfs_congestion_kb); | 231 | debugfs_remove(fsc->debugfs_congestion_kb); |
195 | debugfs_remove(fsc->debugfs_mdsmap); | 232 | debugfs_remove(fsc->debugfs_mdsmap); |
233 | debugfs_remove(fsc->debugfs_mds_sessions); | ||
196 | debugfs_remove(fsc->debugfs_caps); | 234 | debugfs_remove(fsc->debugfs_caps); |
197 | debugfs_remove(fsc->debugfs_mdsc); | 235 | debugfs_remove(fsc->debugfs_mdsc); |
198 | debugfs_remove(fsc->debugfs_dentry_lru); | 236 | debugfs_remove(fsc->debugfs_dentry_lru); |
@@ -231,6 +269,14 @@ int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | |||
231 | if (!fsc->debugfs_mdsmap) | 269 | if (!fsc->debugfs_mdsmap) |
232 | goto out; | 270 | goto out; |
233 | 271 | ||
272 | fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions", | ||
273 | 0600, | ||
274 | fsc->client->debugfs_dir, | ||
275 | fsc, | ||
276 | &mds_sessions_show_fops); | ||
277 | if (!fsc->debugfs_mds_sessions) | ||
278 | goto out; | ||
279 | |||
234 | fsc->debugfs_mdsc = debugfs_create_file("mdsc", | 280 | fsc->debugfs_mdsc = debugfs_create_file("mdsc", |
235 | 0600, | 281 | 0600, |
236 | fsc->client->debugfs_dir, | 282 | fsc->client->debugfs_dir, |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index f62a09863ff1..b82f507979b8 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -95,6 +95,7 @@ struct ceph_fs_client { | |||
95 | struct dentry *debugfs_congestion_kb; | 95 | struct dentry *debugfs_congestion_kb; |
96 | struct dentry *debugfs_bdi; | 96 | struct dentry *debugfs_bdi; |
97 | struct dentry *debugfs_mdsc, *debugfs_mdsmap; | 97 | struct dentry *debugfs_mdsc, *debugfs_mdsmap; |
98 | struct dentry *debugfs_mds_sessions; | ||
98 | #endif | 99 | #endif |
99 | 100 | ||
100 | #ifdef CONFIG_CEPH_FSCACHE | 101 | #ifdef CONFIG_CEPH_FSCACHE |