drivers/md/dm-vdo/dump.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/dump.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/dump.c- Extension
.c- Size
- 8523 bytes
- Lines
- 276
- 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
dump.hlinux/module.hmemory-alloc.hstring-utils.hconstants.hdata-vio.hdedupe.hfunnel-workqueue.hio-submitter.hlogger.htypes.hvdo.h
Detected Declarations
enum dump_optionsenum dump_option_flagsfunction is_arg_stringfunction do_dumpfunction parse_dump_optionsfunction vdo_dumpfunction vdo_dump_allfunction queuefunction encode_vio_dump_flagsfunction dump_data_vio
Annotated Snippet
if (is_arg_string(argv[i], option_names[j].name)) {
dump_options_requested |= option_names[j].flags;
break;
}
}
if (j == ARRAY_SIZE(option_names)) {
vdo_log_warning("dump option name '%s' unknown", argv[i]);
options_okay = false;
}
}
if (!options_okay)
return -EINVAL;
if ((dump_options_requested & FLAG_SKIP_DEFAULT) == 0)
dump_options_requested |= DEFAULT_DUMP_FLAGS;
*dump_options_requested_ptr = dump_options_requested;
return 0;
}
/* Dump as specified by zero or more string arguments. */
int vdo_dump(struct vdo *vdo, unsigned int argc, char *const *argv, const char *why)
{
unsigned int dump_options_requested = 0;
int result = parse_dump_options(argc, argv, &dump_options_requested);
if (result != 0)
return result;
do_dump(vdo, dump_options_requested, why);
return 0;
}
/* Dump everything we know how to dump */
void vdo_dump_all(struct vdo *vdo, const char *why)
{
do_dump(vdo, ~0, why);
}
/*
* Dump out the data_vio waiters on a waitq.
* wait_on should be the label to print for queue (e.g. logical or physical)
*/
static void dump_vio_waiters(struct vdo_wait_queue *waitq, char *wait_on)
{
struct vdo_waiter *waiter, *first = vdo_waitq_get_first_waiter(waitq);
struct data_vio *data_vio;
if (first == NULL)
return;
data_vio = vdo_waiter_as_data_vio(first);
vdo_log_info(" %s is locked. Waited on by: vio %px pbn %llu lbn %llu d-pbn %llu lastOp %s",
wait_on, data_vio, data_vio->allocation.pbn, data_vio->logical.lbn,
data_vio->duplicate.pbn, get_data_vio_operation_name(data_vio));
for (waiter = first->next_waiter; waiter != first; waiter = waiter->next_waiter) {
data_vio = vdo_waiter_as_data_vio(waiter);
vdo_log_info(" ... and : vio %px pbn %llu lbn %llu d-pbn %llu lastOp %s",
data_vio, data_vio->allocation.pbn, data_vio->logical.lbn,
data_vio->duplicate.pbn,
get_data_vio_operation_name(data_vio));
}
}
/*
* Encode various attributes of a data_vio as a string of one-character flags. This encoding is for
* logging brevity:
*
* R => vio completion result not VDO_SUCCESS
* W => vio is on a waitq
* D => vio is a duplicate
* p => vio is a partial block operation
* z => vio is a zero block
* d => vio is a discard
*
* The common case of no flags set will result in an empty, null-terminated buffer. If any flags
* are encoded, the first character in the string will be a space character.
*/
static void encode_vio_dump_flags(struct data_vio *data_vio, char buffer[8])
{
char *p_flag = buffer;
*p_flag++ = ' ';
if (data_vio->vio.completion.result != VDO_SUCCESS)
*p_flag++ = 'R';
if (data_vio->waiter.next_waiter != NULL)
*p_flag++ = 'W';
if (data_vio->is_duplicate)
*p_flag++ = 'D';
if (data_vio->is_partial)
*p_flag++ = 'p';
Annotation
- Immediate include surface: `dump.h`, `linux/module.h`, `memory-alloc.h`, `string-utils.h`, `constants.h`, `data-vio.h`, `dedupe.h`, `funnel-workqueue.h`.
- Detected declarations: `enum dump_options`, `enum dump_option_flags`, `function is_arg_string`, `function do_dump`, `function parse_dump_options`, `function vdo_dump`, `function vdo_dump_all`, `function queue`, `function encode_vio_dump_flags`, `function dump_data_vio`.
- 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.