drivers/md/dm-stats.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-stats.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-stats.h- Extension
.h- Size
- 1162 bytes
- Lines
- 49
- Domain
- Driver Families
- Bucket
- drivers/md
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/mutex.hlinux/list.h
Detected Declarations
struct dm_statsstruct dm_stats_auxstruct mapped_devicefunction dm_stats_usedfunction dm_stats_record_start
Annotated Snippet
struct dm_stats {
struct mutex mutex;
struct list_head list; /* list of struct dm_stat */
struct dm_stats_last_position __percpu *last;
bool precise_timestamps;
};
struct dm_stats_aux {
bool merged;
unsigned long long duration_ns;
};
int dm_stats_init(struct dm_stats *st);
void dm_stats_cleanup(struct dm_stats *st);
struct mapped_device;
int dm_stats_message(struct mapped_device *md, unsigned int argc, char **argv,
char *result, unsigned int maxlen);
void dm_stats_account_io(struct dm_stats *stats, unsigned long bi_rw,
sector_t bi_sector, unsigned int bi_sectors, bool end,
unsigned long start_time,
struct dm_stats_aux *aux);
static inline bool dm_stats_used(struct dm_stats *st)
{
return !list_empty(&st->list);
}
static inline void dm_stats_record_start(struct dm_stats *stats, struct dm_stats_aux *aux)
{
if (unlikely(stats->precise_timestamps))
aux->duration_ns = ktime_to_ns(ktime_get());
}
#endif
Annotation
- Immediate include surface: `linux/types.h`, `linux/mutex.h`, `linux/list.h`.
- Detected declarations: `struct dm_stats`, `struct dm_stats_aux`, `struct mapped_device`, `function dm_stats_used`, `function dm_stats_record_start`.
- Atlas domain: Driver Families / drivers/md.
- 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.