drivers/md/dm-vdo/indexer/index-layout.c

Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/indexer/index-layout.c

File Facts

System
Linux kernel
Corpus path
drivers/md/dm-vdo/indexer/index-layout.c
Extension
.c
Size
50068 bytes
Lines
1765
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 region_header {
	u64 magic;
	u64 region_blocks;
	u16 type;
	/* Currently always version 1 */
	u16 version;
	u16 region_count;
	u16 payload;
};

struct layout_region {
	u64 start_block;
	u64 block_count;
	u32 __unused;
	u16 kind;
	u16 instance;
};

struct region_table {
	size_t encoded_size;
	struct region_header header;
	struct layout_region regions[];
};

struct index_save_data {
	u64 timestamp;
	u64 nonce;
	/* Currently always version 1 */
	u32 version;
	u32 unused__;
};

struct index_state_version {
	s32 signature;
	s32 version_id;
};

static const struct index_state_version INDEX_STATE_VERSION_301 = {
	.signature  = -1,
	.version_id = 301,
};

struct index_state_data301 {
	struct index_state_version version;
	u64 newest_chapter;
	u64 oldest_chapter;
	u64 last_save;
	u32 unused;
	u32 padding;
};

struct index_save_layout {
	unsigned int zone_count;
	struct layout_region index_save;
	struct layout_region header;
	struct layout_region index_page_map;
	struct layout_region free_space;
	struct layout_region volume_index_zones[MAX_ZONES];
	struct layout_region open_chapter;
	struct index_save_data save_data;
	struct index_state_data301 state_data;
};

struct sub_index_layout {
	u64 nonce;
	struct layout_region sub_index;
	struct layout_region volume;
	struct index_save_layout *saves;
};

struct super_block_data {
	u8 magic_label[MAGIC_SIZE];
	u8 nonce_info[NONCE_INFO_SIZE];
	u64 nonce;
	u32 version;
	u32 block_size;
	u16 index_count;
	u16 max_saves;
	/* Padding reflects a blank field on permanent storage */
	u8 padding[4];
	u64 open_chapter_blocks;
	u64 page_map_blocks;
	u64 volume_offset;
	u64 start_offset;
};

struct index_layout {
	struct io_factory *factory;
	size_t factory_size;
	off_t offset;

Annotation

Implementation Notes