drivers/md/dm-vdo/types.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/types.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/types.h- Extension
.h- Size
- 11108 bytes
- Lines
- 400
- 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/bio.hlinux/blkdev.hlinux/device-mapper.hlinux/list.hlinux/compiler_attributes.hlinux/types.hfunnel-queue.h
Detected Declarations
struct block_map_slotstruct data_locationstruct slab_configstruct thread_count_configstruct device_configstruct vdo_completionstruct vdo_completionstruct block_allocatorstruct data_viostruct vdostruct vdo_configstruct vioenum vdo_stateenum journal_operationenum partition_idenum vdo_metadata_typeenum block_mapping_stateenum vdo_completion_typeenum vdo_completion_priorityenum vio_typeenum vio_priorityfunction vdo_state_requires_read_only_rebuildfunction vdo_state_requires_recovery
Annotated Snippet
struct block_map_slot {
physical_block_number_t pbn;
slot_number_t slot;
};
/*
* Four bits of each five-byte block map entry contain a mapping state value used to distinguish
* unmapped or discarded logical blocks (which are treated as mapped to the zero block) from entries
* that have been mapped to a physical block, including the zero block.
*
* FIXME: these should maybe be defines.
*/
enum block_mapping_state {
VDO_MAPPING_STATE_UNMAPPED = 0, /* Must be zero to be the default value */
VDO_MAPPING_STATE_UNCOMPRESSED = 1, /* A normal (uncompressed) block */
VDO_MAPPING_STATE_COMPRESSED_BASE = 2, /* Compressed in slot 0 */
VDO_MAPPING_STATE_COMPRESSED_MAX = 15, /* Compressed in slot 13 */
};
enum {
VDO_MAX_COMPRESSION_SLOTS =
(VDO_MAPPING_STATE_COMPRESSED_MAX - VDO_MAPPING_STATE_COMPRESSED_BASE + 1),
};
struct data_location {
physical_block_number_t pbn;
enum block_mapping_state state;
};
/* The configuration of a single slab derived from the configured block size and slab size. */
struct slab_config {
/* total number of blocks in the slab */
block_count_t slab_blocks;
/* number of blocks available for data */
block_count_t data_blocks;
/* number of blocks for reference counts */
block_count_t reference_count_blocks;
/* number of blocks for the slab journal */
block_count_t slab_journal_blocks;
/*
* Number of blocks after which the slab journal starts pushing out a reference_block for
* each new entry it receives.
*/
block_count_t slab_journal_flushing_threshold;
/*
* Number of blocks after which the slab journal pushes out all reference_blocks and makes
* all vios wait.
*/
block_count_t slab_journal_blocking_threshold;
/* Number of blocks after which the slab must be scrubbed before coming online. */
block_count_t slab_journal_scrubbing_threshold;
} __packed;
/*
* This structure is memcmp'd for equality. Keep it packed and don't add any fields that are not
* properly set in both extant and parsed configs.
*/
struct thread_count_config {
unsigned int bio_ack_threads;
unsigned int bio_threads;
unsigned int bio_rotation_interval;
unsigned int cpu_threads;
unsigned int logical_zones;
unsigned int physical_zones;
unsigned int hash_zones;
} __packed;
struct device_config {
struct dm_target *owning_target;
struct dm_dev *owned_device;
struct vdo *vdo;
/* All configs referencing a layer are kept on a list in the layer */
struct list_head config_list;
char *original_string;
unsigned int version;
char *parent_device_name;
block_count_t physical_blocks;
/*
* This is the number of logical blocks from VDO's internal point of view. It is the number
* of 4K blocks regardless of the value of the logical_block_size parameter below.
*/
block_count_t logical_blocks;
unsigned int logical_block_size;
unsigned int cache_size;
unsigned int block_map_maximum_age;
bool deduplication;
bool compression;
struct thread_count_config thread_counts;
block_count_t max_discard_blocks;
Annotation
- Immediate include surface: `linux/bio.h`, `linux/blkdev.h`, `linux/device-mapper.h`, `linux/list.h`, `linux/compiler_attributes.h`, `linux/types.h`, `funnel-queue.h`.
- Detected declarations: `struct block_map_slot`, `struct data_location`, `struct slab_config`, `struct thread_count_config`, `struct device_config`, `struct vdo_completion`, `struct vdo_completion`, `struct block_allocator`, `struct data_vio`, `struct vdo`.
- 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.