drivers/md/dm-vdo/message-stats.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/message-stats.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/message-stats.c- Extension
.c- Size
- 20502 bytes
- Lines
- 481
- 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
dedupe.hindexer.hlogger.hmemory-alloc.hmessage-stats.hstatistics.hthread-device.hvdo.h
Detected Declarations
function write_u64function write_u32function write_block_count_tfunction write_stringfunction write_boolfunction write_u8function write_block_allocator_statisticsfunction write_commit_statisticsfunction write_recovery_journal_statisticsfunction write_packer_statisticsfunction write_slab_journal_statisticsfunction write_slab_summary_statisticsfunction write_ref_counts_statisticsfunction write_block_map_statisticsfunction write_hash_lock_statisticsfunction write_error_statisticsfunction write_bio_statsfunction write_memory_usagefunction write_index_statisticsfunction write_vdo_statisticsfunction vdo_write_statsfunction write_index_memoryfunction write_index_configfunction vdo_write_config
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2023 Red Hat
*/
#include "dedupe.h"
#include "indexer.h"
#include "logger.h"
#include "memory-alloc.h"
#include "message-stats.h"
#include "statistics.h"
#include "thread-device.h"
#include "vdo.h"
static void write_u64(char *prefix, u64 value, char *suffix, char **buf,
unsigned int *maxlen)
{
int count;
count = scnprintf(*buf, *maxlen, "%s%llu%s", prefix == NULL ? "" : prefix,
value, suffix == NULL ? "" : suffix);
*buf += count;
*maxlen -= count;
}
static void write_u32(char *prefix, u32 value, char *suffix, char **buf,
unsigned int *maxlen)
{
int count;
count = scnprintf(*buf, *maxlen, "%s%u%s", prefix == NULL ? "" : prefix,
value, suffix == NULL ? "" : suffix);
*buf += count;
*maxlen -= count;
}
static void write_block_count_t(char *prefix, block_count_t value, char *suffix,
char **buf, unsigned int *maxlen)
{
int count;
count = scnprintf(*buf, *maxlen, "%s%llu%s", prefix == NULL ? "" : prefix,
value, suffix == NULL ? "" : suffix);
*buf += count;
*maxlen -= count;
}
static void write_string(char *prefix, char *value, char *suffix, char **buf,
unsigned int *maxlen)
{
int count;
count = scnprintf(*buf, *maxlen, "%s%s%s", prefix == NULL ? "" : prefix,
value, suffix == NULL ? "" : suffix);
*buf += count;
*maxlen -= count;
}
static void write_bool(char *prefix, bool value, char *suffix, char **buf,
unsigned int *maxlen)
{
int count;
count = scnprintf(*buf, *maxlen, "%s%d%s", prefix == NULL ? "" : prefix,
value, suffix == NULL ? "" : suffix);
*buf += count;
*maxlen -= count;
}
static void write_u8(char *prefix, u8 value, char *suffix, char **buf,
unsigned int *maxlen)
{
int count;
count = scnprintf(*buf, *maxlen, "%s%u%s", prefix == NULL ? "" : prefix,
value, suffix == NULL ? "" : suffix);
*buf += count;
*maxlen -= count;
}
static void write_block_allocator_statistics(char *prefix,
struct block_allocator_statistics *stats,
char *suffix, char **buf,
unsigned int *maxlen)
{
write_string(prefix, "{ ", NULL, buf, maxlen);
/* The total number of slabs from which blocks may be allocated */
write_u64("slabCount : ", stats->slab_count, ", ", buf, maxlen);
/* The total number of slabs from which blocks have ever been allocated */
write_u64("slabsOpened : ", stats->slabs_opened, ", ", buf, maxlen);
Annotation
- Immediate include surface: `dedupe.h`, `indexer.h`, `logger.h`, `memory-alloc.h`, `message-stats.h`, `statistics.h`, `thread-device.h`, `vdo.h`.
- Detected declarations: `function write_u64`, `function write_u32`, `function write_block_count_t`, `function write_string`, `function write_bool`, `function write_u8`, `function write_block_allocator_statistics`, `function write_commit_statistics`, `function write_recovery_journal_statistics`, `function write_packer_statistics`.
- 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.