drivers/md/dm-vdo/slab-depot.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/slab-depot.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/slab-depot.c- Extension
.c- Size
- 169844 bytes
- Lines
- 5191
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
slab-depot.hlinux/atomic.hlinux/bio.hlinux/err.hlinux/log2.hlinux/min_heap.hlinux/minmax.hlogger.hmemory-alloc.hnumeric.hpermassert.hstring-utils.haction-manager.hadmin-state.hcompletion.hconstants.hdata-vio.hencodings.hio-submitter.hphysical-zone.hpriority-table.hrecovery-journal.hrepair.hstatus-codes.htypes.hvdo.hvio.hwait-queue.h
Detected Declarations
function get_lockfunction is_slab_openfunction must_make_entries_to_flushfunction is_reapingfunction initialize_tail_blockfunction initialize_journal_statefunction block_is_fullfunction is_slab_journal_blankfunction mark_slab_journal_dirtyfunction mark_slab_journal_cleanfunction check_if_slab_drainedfunction compute_fullness_hintfunction check_summary_drain_completefunction notify_summary_waitersfunction finish_updating_slab_summary_blockfunction finish_updatefunction handle_write_errorfunction write_slab_summary_endiofunction launch_writefunction update_slab_summary_entryfunction finish_reapingfunction complete_reapingfunction handle_flush_errorfunction flush_endiofunction flush_for_reapingfunction reap_slab_journalfunction adjust_slab_journal_block_referencefunction release_journal_locksfunction update_tail_block_locationfunction reopen_slab_journalfunction get_committing_sequence_numberfunction complete_writefunction write_slab_journal_endiofunction write_slab_journal_blockfunction commit_tailfunction encode_slab_journal_entryfunction expand_journal_pointfunction add_entryfunction journal_lengthfunction vdo_attempt_replay_into_slabfunction requires_reapingfunction finish_summary_updatefunction launch_reference_block_writefunction save_dirty_reference_blocksfunction finish_reference_block_writefunction get_reference_counters_for_blockfunction pack_reference_blockfunction write_reference_block_endio
Annotated Snippet
vdo_is_state_quiescent(&allocator->summary_state)) {
result = VDO_INVALID_ADMIN_STATE;
waiter->callback(waiter, &result);
return;
}
entry = &allocator->summary_entries[slab->slab_number];
*entry = (struct slab_summary_entry) {
.tail_block_offset = tail_block_offset,
.load_ref_counts = (entry->load_ref_counts || load_ref_counts),
.is_dirty = !is_clean,
.fullness_hint = compute_fullness_hint(allocator->depot, free_blocks),
};
vdo_waitq_enqueue_waiter(&block->next_update_waiters, waiter);
launch_write(block);
}
/**
* finish_reaping() - Actually advance the head of the journal now that any necessary flushes are
* complete.
* @journal: The journal to be reaped.
*/
static void finish_reaping(struct slab_journal *journal)
{
journal->head = journal->unreapable;
add_entries(journal);
check_if_slab_drained(journal->slab);
}
static void reap_slab_journal(struct slab_journal *journal);
/**
* complete_reaping() - Finish reaping now that we have flushed the lower layer and then try
* reaping again in case we deferred reaping due to an outstanding vio.
* @completion: The flush vio.
*/
static void complete_reaping(struct vdo_completion *completion)
{
struct slab_journal *journal = completion->parent;
return_vio_to_pool(vio_as_pooled_vio(as_vio(completion)));
finish_reaping(journal);
reap_slab_journal(journal);
}
/**
* handle_flush_error() - Handle an error flushing the lower layer.
* @completion: The flush vio.
*/
static void handle_flush_error(struct vdo_completion *completion)
{
vio_record_metadata_io_error(as_vio(completion));
vdo_enter_read_only_mode(completion->vdo, completion->result);
complete_reaping(completion);
}
static void flush_endio(struct bio *bio)
{
struct vio *vio = bio->bi_private;
struct slab_journal *journal = vio->completion.parent;
continue_vio_after_io(vio, complete_reaping,
journal->slab->allocator->thread_id);
}
/**
* flush_for_reaping() - A waiter callback for getting a vio with which to flush the lower layer
* prior to reaping.
* @waiter: The journal as a flush waiter.
* @context: The newly acquired flush vio.
*/
static void flush_for_reaping(struct vdo_waiter *waiter, void *context)
{
struct slab_journal *journal =
container_of(waiter, struct slab_journal, flush_waiter);
struct pooled_vio *pooled = context;
struct vio *vio = &pooled->vio;
vio->completion.parent = journal;
vdo_submit_flush_vio(vio, flush_endio, handle_flush_error);
}
/**
* reap_slab_journal() - Conduct a reap on a slab journal to reclaim unreferenced blocks.
* @journal: The slab journal.
*/
static void reap_slab_journal(struct slab_journal *journal)
{
bool reaped = false;
Annotation
- Immediate include surface: `slab-depot.h`, `linux/atomic.h`, `linux/bio.h`, `linux/err.h`, `linux/log2.h`, `linux/min_heap.h`, `linux/minmax.h`, `logger.h`.
- Detected declarations: `function get_lock`, `function is_slab_open`, `function must_make_entries_to_flush`, `function is_reaping`, `function initialize_tail_block`, `function initialize_journal_state`, `function block_is_full`, `function is_slab_journal_blank`, `function mark_slab_journal_dirty`, `function mark_slab_journal_clean`.
- Atlas domain: Driver Families / drivers/md.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.