fs/ceph/debugfs.c
Source file repositories/reference/linux-study-clean/fs/ceph/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ceph/debugfs.c- Extension
.c- Size
- 18627 bytes
- Lines
- 643
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ceph/ceph_debug.hlinux/device.hlinux/slab.hlinux/module.hlinux/ctype.hlinux/debugfs.hlinux/seq_file.hlinux/math64.hlinux/ktime.hlinux/atomic.hlinux/ceph/libceph.hlinux/ceph/mon_client.hlinux/ceph/auth.hlinux/ceph/debugfs.hlinux/ceph/decode.hsuper.hmds_client.hmetric.hsubvolume_metrics.h
Detected Declarations
struct ceph_session_feature_descfunction mdsmap_showfunction mdsc_showfunction metrics_file_showfunction metrics_latency_showfunction metrics_size_showfunction metrics_caps_showfunction caps_show_cbfunction caps_showfunction mds_sessions_showfunction status_showfunction subvolume_metrics_showfunction metric_features_showfunction congestion_kb_setfunction congestion_kb_getfunction ceph_fs_debugfs_cleanupfunction ceph_fs_debugfs_initfunction ceph_fs_debugfs_init
Annotated Snippet
struct ceph_session_feature_desc {
unsigned int bit;
const char *name;
};
static const struct ceph_session_feature_desc ceph_session_feature_table[] = {
{ CEPHFS_FEATURE_METRIC_COLLECT, "METRIC_COLLECT" },
{ CEPHFS_FEATURE_REPLY_ENCODING, "REPLY_ENCODING" },
{ CEPHFS_FEATURE_RECLAIM_CLIENT, "RECLAIM_CLIENT" },
{ CEPHFS_FEATURE_LAZY_CAP_WANTED, "LAZY_CAP_WANTED" },
{ CEPHFS_FEATURE_MULTI_RECONNECT, "MULTI_RECONNECT" },
{ CEPHFS_FEATURE_DELEG_INO, "DELEG_INO" },
{ CEPHFS_FEATURE_ALTERNATE_NAME, "ALTERNATE_NAME" },
{ CEPHFS_FEATURE_NOTIFY_SESSION_STATE, "NOTIFY_SESSION_STATE" },
{ CEPHFS_FEATURE_OP_GETVXATTR, "OP_GETVXATTR" },
{ CEPHFS_FEATURE_32BITS_RETRY_FWD, "32BITS_RETRY_FWD" },
{ CEPHFS_FEATURE_NEW_SNAPREALM_INFO, "NEW_SNAPREALM_INFO" },
{ CEPHFS_FEATURE_HAS_OWNER_UIDGID, "HAS_OWNER_UIDGID" },
{ CEPHFS_FEATURE_MDS_AUTH_CAPS_CHECK, "MDS_AUTH_CAPS_CHECK" },
{ CEPHFS_FEATURE_SUBVOLUME_METRICS, "SUBVOLUME_METRICS" },
};
static int mdsmap_show(struct seq_file *s, void *p)
{
int i;
struct ceph_fs_client *fsc = s->private;
struct ceph_mdsmap *mdsmap;
if (!fsc->mdsc || !fsc->mdsc->mdsmap)
return 0;
mdsmap = fsc->mdsc->mdsmap;
seq_printf(s, "epoch %d\n", mdsmap->m_epoch);
seq_printf(s, "root %d\n", mdsmap->m_root);
seq_printf(s, "max_mds %d\n", mdsmap->m_max_mds);
seq_printf(s, "session_timeout %d\n", mdsmap->m_session_timeout);
seq_printf(s, "session_autoclose %d\n", mdsmap->m_session_autoclose);
for (i = 0; i < mdsmap->possible_max_rank; i++) {
struct ceph_entity_addr *addr = &mdsmap->m_info[i].addr;
int state = mdsmap->m_info[i].state;
seq_printf(s, "\tmds%d\t%s\t(%s)\n", i,
ceph_pr_addr(addr),
ceph_mds_state_name(state));
}
return 0;
}
/*
* mdsc debugfs
*/
static int mdsc_show(struct seq_file *s, void *p)
{
struct ceph_fs_client *fsc = s->private;
struct ceph_mds_client *mdsc = fsc->mdsc;
struct ceph_mds_request *req;
struct rb_node *rp;
char *path;
mutex_lock(&mdsc->mutex);
for (rp = rb_first(&mdsc->request_tree); rp; rp = rb_next(rp)) {
req = rb_entry(rp, struct ceph_mds_request, r_node);
if (req->r_request && req->r_session)
seq_printf(s, "%lld\tmds%d\t", req->r_tid,
req->r_session->s_mds);
else if (!req->r_request)
seq_printf(s, "%lld\t(no request)\t", req->r_tid);
else
seq_printf(s, "%lld\t(no session)\t", req->r_tid);
seq_printf(s, "%s", ceph_mds_op_name(req->r_op));
if (test_bit(CEPH_MDS_R_GOT_UNSAFE, &req->r_req_flags))
seq_puts(s, "\t(unsafe)");
else
seq_puts(s, "\t");
if (req->r_inode) {
seq_printf(s, " #%llx", ceph_ino(req->r_inode));
} else if (req->r_dentry) {
struct ceph_path_info path_info = {0};
path = ceph_mdsc_build_path(mdsc, req->r_dentry, &path_info, 0);
if (IS_ERR(path))
path = NULL;
spin_lock(&req->r_dentry->d_lock);
seq_printf(s, " #%llx/%pd (%s)",
ceph_ino(d_inode(req->r_dentry->d_parent)),
req->r_dentry,
path ? path : "");
spin_unlock(&req->r_dentry->d_lock);
ceph_mdsc_free_path_info(&path_info);
Annotation
- Immediate include surface: `linux/ceph/ceph_debug.h`, `linux/device.h`, `linux/slab.h`, `linux/module.h`, `linux/ctype.h`, `linux/debugfs.h`, `linux/seq_file.h`, `linux/math64.h`.
- Detected declarations: `struct ceph_session_feature_desc`, `function mdsmap_show`, `function mdsc_show`, `function metrics_file_show`, `function metrics_latency_show`, `function metrics_size_show`, `function metrics_caps_show`, `function caps_show_cb`, `function caps_show`, `function mds_sessions_show`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.