drivers/md/dm-vdo/repair.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/repair.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/repair.c- Extension
.c- Size
- 58163 bytes
- Lines
- 1758
- 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
repair.hlinux/min_heap.hlinux/minmax.hlogger.hmemory-alloc.hpermassert.hblock-map.hcompletion.hconstants.hencodings.hint-map.hio-submitter.hrecovery-journal.hslab-depot.htypes.hvdo.hwait-queue.h
Detected Declarations
struct numbered_block_mappingstruct recovery_pointstruct repair_completionfunction mapping_is_less_thanfunction swap_mappingsfunction as_repair_completionfunction prepare_repair_completionfunction launch_repair_completionfunction uninitialize_viosfunction free_repair_completionfunction finish_repairfunction abort_repairfunction abort_on_errorfunction drain_slab_depotfunction flush_block_map_updatesfunction handle_page_load_errorfunction unmap_entryfunction remove_out_of_bounds_entriesfunction process_slotfunction rebuild_reference_counts_from_pagefunction page_loadedfunction get_pbn_to_fetchfunction fetch_pagefunction rebuild_from_leavesfunction process_entryfunction rebuild_reference_countsfunction increment_recovery_pointfunction advance_pointsfunction before_recovery_pointfunction get_sectorfunction get_entryfunction validate_recovery_journal_entryfunction add_slab_journal_entriesfunction advance_pointsfunction vdo_replay_into_slab_journalsfunction load_slab_depotfunction flush_block_mapfunction finish_if_donefunction abort_block_map_recoveryfunction find_entry_starting_next_pagefunction apply_journal_entries_to_pagefunction block_map_page_loadedfunction handle_block_map_page_load_errorfunction fetch_block_map_pagefunction recover_ready_pagesfunction recover_block_mapfunction get_recovery_journal_block_headerfunction is_valid_recovery_journal_block
Annotated Snippet
struct numbered_block_mapping {
struct block_map_slot block_map_slot;
struct block_map_entry block_map_entry;
/* A serial number to use during replay */
u32 number;
} __packed;
/*
* The absolute position of an entry in the recovery journal, including the sector number and the
* entry number within the sector.
*/
struct recovery_point {
/* Block sequence number */
sequence_number_t sequence_number;
/* Sector number */
u8 sector_count;
/* Entry number */
journal_entry_count_t entry_count;
/* Whether or not the increment portion of the current entry has been applied */
bool increment_applied;
};
DEFINE_MIN_HEAP(struct numbered_block_mapping, replay_heap);
struct repair_completion {
/* The completion header */
struct vdo_completion completion;
/* A buffer to hold the data read off disk */
char *journal_data;
/* For loading the journal */
data_vio_count_t vio_count;
data_vio_count_t vios_complete;
struct vio *vios;
/* The number of entries to be applied to the block map */
size_t block_map_entry_count;
/* The sequence number of the first valid block for block map recovery */
sequence_number_t block_map_head;
/* The sequence number of the first valid block for slab journal replay */
sequence_number_t slab_journal_head;
/* The sequence number of the last valid block of the journal (if known) */
sequence_number_t tail;
/*
* The highest sequence number of the journal. During recovery (vs read-only rebuild), not
* the same as the tail, since the tail ignores blocks after the first hole.
*/
sequence_number_t highest_tail;
/* The number of logical blocks currently known to be in use */
block_count_t logical_blocks_used;
/* The number of block map data blocks known to be allocated */
block_count_t block_map_data_blocks;
/* These fields are for playing the journal into the block map */
/* The entry data for the block map recovery */
struct numbered_block_mapping *entries;
/* The number of entries in the entry array */
size_t entry_count;
/* number of pending (non-ready) requests*/
page_count_t outstanding;
/* number of page completions */
page_count_t page_count;
bool launching;
/*
* a heap wrapping journal_entries. It re-orders and sorts journal entries in ascending LBN
* order, then original journal order. This permits efficient iteration over the journal
* entries in order.
*/
struct replay_heap replay_heap;
/* Fields tracking progress through the journal entries. */
struct numbered_block_mapping *current_entry;
struct numbered_block_mapping *current_unfetched_entry;
/* Current requested page's PBN */
physical_block_number_t pbn;
/* These fields are only used during recovery. */
/* A location just beyond the last valid entry of the journal */
struct recovery_point tail_recovery_point;
/* The location of the next recovery journal entry to apply */
struct recovery_point next_recovery_point;
/* The journal point to give to the next synthesized decref */
struct journal_point next_journal_point;
/* The number of entries played into slab journals */
size_t entries_added_to_slab_journals;
/* These fields are only used during read-only rebuild */
page_count_t page_to_fetch;
/* the number of leaf pages in the block map */
Annotation
- Immediate include surface: `repair.h`, `linux/min_heap.h`, `linux/minmax.h`, `logger.h`, `memory-alloc.h`, `permassert.h`, `block-map.h`, `completion.h`.
- Detected declarations: `struct numbered_block_mapping`, `struct recovery_point`, `struct repair_completion`, `function mapping_is_less_than`, `function swap_mappings`, `function as_repair_completion`, `function prepare_repair_completion`, `function launch_repair_completion`, `function uninitialize_vios`, `function free_repair_completion`.
- 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.