Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

John Spray and committed by
Sage Weil
14ed9703 a687ecaf

+47
+46
fs/ceph/debugfs.c
··· 158 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 197 CEPH_DEFINE_SHOW_FUNC(mdsmap_show) 162 198 CEPH_DEFINE_SHOW_FUNC(mdsc_show) 163 199 CEPH_DEFINE_SHOW_FUNC(caps_show) 164 200 CEPH_DEFINE_SHOW_FUNC(dentry_lru_show) 201 + CEPH_DEFINE_SHOW_FUNC(mds_sessions_show) 165 202 166 203 167 204 /* ··· 230 193 debugfs_remove(fsc->debugfs_bdi); 231 194 debugfs_remove(fsc->debugfs_congestion_kb); 232 195 debugfs_remove(fsc->debugfs_mdsmap); 196 + debugfs_remove(fsc->debugfs_mds_sessions); 233 197 debugfs_remove(fsc->debugfs_caps); 234 198 debugfs_remove(fsc->debugfs_mdsc); 235 199 debugfs_remove(fsc->debugfs_dentry_lru); ··· 267 229 fsc, 268 230 &mdsmap_show_fops); 269 231 if (!fsc->debugfs_mdsmap) 232 + goto out; 233 + 234 + fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions", 235 + 0600, 236 + fsc->client->debugfs_dir, 237 + fsc, 238 + &mds_sessions_show_fops); 239 + if (!fsc->debugfs_mds_sessions) 270 240 goto out; 271 241 272 242 fsc->debugfs_mdsc = debugfs_create_file("mdsc",
+1
fs/ceph/super.h
··· 95 95 struct dentry *debugfs_congestion_kb; 96 96 struct dentry *debugfs_bdi; 97 97 struct dentry *debugfs_mdsc, *debugfs_mdsmap; 98 + struct dentry *debugfs_mds_sessions; 98 99 #endif 99 100 100 101 #ifdef CONFIG_CEPH_FSCACHE