fs/ceph/subvolume_metrics.h
Source file repositories/reference/linux-study-clean/fs/ceph/subvolume_metrics.h
File Facts
- System
- Linux kernel
- Corpus path
fs/ceph/subvolume_metrics.h- Extension
.h- Size
- 3855 bytes
- Lines
- 98
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/rbtree.hlinux/spinlock.hlinux/ktime.hlinux/atomic.h
Detected Declarations
struct seq_filestruct ceph_mds_clientstruct ceph_inode_infostruct ceph_subvol_metric_snapshotstruct ceph_subvolume_metrics_trackerfunction ceph_subvolume_metrics_enabled
Annotated Snippet
struct ceph_subvol_metric_snapshot {
u64 subvolume_id;
u64 read_ops;
u64 write_ops;
u64 read_bytes;
u64 write_bytes;
u64 read_latency_us;
u64 write_latency_us;
};
/**
* struct ceph_subvolume_metrics_tracker - Tracks per-subvolume I/O metrics
* @lock: Protects @tree and @nr_entries during concurrent access
* @tree: Red-black tree of per-subvolume entries, keyed by subvolume_id
* @nr_entries: Number of entries currently in @tree
* @enabled: Whether collection is enabled (requires MDS feature support)
* @snapshot_attempts: Debug counter: total ceph_subvolume_metrics_snapshot() calls
* @snapshot_empty: Debug counter: snapshots that found no data to report
* @snapshot_failures: Debug counter: snapshots that failed to allocate memory
* @record_calls: Debug counter: total ceph_subvolume_metrics_record() calls
* @record_disabled: Debug counter: record calls skipped because disabled
* @record_no_subvol: Debug counter: record calls skipped (no subvolume_id)
* @total_read_ops: Cumulative read ops across all snapshots (never reset)
* @total_read_bytes: Cumulative bytes read across all snapshots (never reset)
* @total_write_ops: Cumulative write ops across all snapshots (never reset)
* @total_write_bytes: Cumulative bytes written across all snapshots (never reset)
*/
struct ceph_subvolume_metrics_tracker {
spinlock_t lock;
struct rb_root_cached tree;
u32 nr_entries;
bool enabled;
atomic64_t snapshot_attempts;
atomic64_t snapshot_empty;
atomic64_t snapshot_failures;
atomic64_t record_calls;
atomic64_t record_disabled;
atomic64_t record_no_subvol;
atomic64_t total_read_ops;
atomic64_t total_read_bytes;
atomic64_t total_write_ops;
atomic64_t total_write_bytes;
};
void ceph_subvolume_metrics_init(struct ceph_subvolume_metrics_tracker *tracker);
void ceph_subvolume_metrics_destroy(struct ceph_subvolume_metrics_tracker *tracker);
void ceph_subvolume_metrics_enable(struct ceph_subvolume_metrics_tracker *tracker,
bool enable);
void ceph_subvolume_metrics_record(struct ceph_subvolume_metrics_tracker *tracker,
u64 subvol_id, bool is_write,
size_t size, u64 latency_us);
int ceph_subvolume_metrics_snapshot(struct ceph_subvolume_metrics_tracker *tracker,
struct ceph_subvol_metric_snapshot **out,
u32 *nr, bool consume);
void ceph_subvolume_metrics_free_snapshot(struct ceph_subvol_metric_snapshot *snapshot);
void ceph_subvolume_metrics_dump(struct ceph_subvolume_metrics_tracker *tracker,
struct seq_file *s);
void ceph_subvolume_metrics_record_io(struct ceph_mds_client *mdsc,
struct ceph_inode_info *ci,
bool is_write, size_t bytes,
ktime_t start, ktime_t end);
static inline bool ceph_subvolume_metrics_enabled(
const struct ceph_subvolume_metrics_tracker *tracker)
{
return READ_ONCE(tracker->enabled);
}
int __init ceph_subvolume_metrics_cache_init(void);
void ceph_subvolume_metrics_cache_destroy(void);
#endif /* _FS_CEPH_SUBVOLUME_METRICS_H */
Annotation
- Immediate include surface: `linux/types.h`, `linux/rbtree.h`, `linux/spinlock.h`, `linux/ktime.h`, `linux/atomic.h`.
- Detected declarations: `struct seq_file`, `struct ceph_mds_client`, `struct ceph_inode_info`, `struct ceph_subvol_metric_snapshot`, `struct ceph_subvolume_metrics_tracker`, `function ceph_subvolume_metrics_enabled`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.