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.

Dependency Surface

Detected Declarations

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

Implementation Notes