drivers/md/dm-vdo/indexer/volume-index.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/indexer/volume-index.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/indexer/volume-index.c- Extension
.c- Size
- 43587 bytes
- Lines
- 1282
- 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
volume-index.hlinux/bitops.hlinux/bits.hlinux/cache.hlinux/compiler.hlinux/log2.herrors.hlogger.hmemory-alloc.hnumeric.hpermassert.hthread-utils.hconfig.hgeometry.hhash-utils.hindexer.h
Detected Declarations
struct sub_index_parametersstruct split_configstruct chapter_rangestruct sub_index_datastruct volume_index_datafunction extract_addressfunction extract_dlist_numfunction get_zone_for_recordfunction convert_index_to_virtualfunction convert_virtual_to_indexfunction is_virtual_chapter_indexedfunction has_sparsefunction uds_is_volume_index_samplefunction get_volume_sub_indexfunction get_volume_sub_index_zonefunction uds_get_volume_index_zonefunction compute_volume_sub_index_parametersfunction uninitialize_volume_sub_indexfunction uds_free_volume_indexfunction compute_volume_sub_index_save_bytesfunction split_configurationfunction compute_volume_index_save_bytesfunction uds_compute_volume_index_save_blocksfunction flush_invalid_entriesfunction get_volume_index_entryfunction get_volume_sub_index_recordfunction uds_get_volume_index_recordfunction uds_put_volume_index_recordfunction uds_remove_volume_index_recordfunction set_volume_sub_index_zone_open_chapterfunction uds_set_volume_index_zone_open_chapterfunction uds_lookup_volume_index_namefunction uds_set_volume_index_open_chapterfunction uds_set_volume_index_record_chapterfunction lookup_volume_sub_index_namefunction uds_lookup_volume_index_namefunction abort_restoring_volume_sub_indexfunction abort_restoring_volume_indexfunction start_restoring_volume_sub_indexfunction start_restoring_volume_indexfunction finish_restoring_volume_sub_indexfunction finish_restoring_volume_indexfunction uds_load_volume_indexfunction start_saving_volume_sub_indexfunction start_saving_volume_indexfunction finish_saving_volume_sub_indexfunction finish_saving_volume_indexfunction uds_save_volume_index
Annotated Snippet
struct sub_index_parameters {
/* The number of bits in address mask */
u8 address_bits;
/* The number of bits in chapter number */
u8 chapter_bits;
/* The mean delta */
u32 mean_delta;
/* The number of delta lists */
u64 list_count;
/* The number of chapters used */
u32 chapter_count;
/* The number of bits per chapter */
size_t chapter_size_in_bits;
/* The number of bytes of delta list memory */
size_t memory_size;
/* The number of bytes the index should keep free at all times */
size_t target_free_bytes;
};
struct split_config {
/* The hook subindex configuration */
struct uds_configuration hook_config;
struct index_geometry hook_geometry;
/* The non-hook subindex configuration */
struct uds_configuration non_hook_config;
struct index_geometry non_hook_geometry;
};
struct chapter_range {
u32 chapter_start;
u32 chapter_count;
};
#define MAGIC_SIZE 8
static const char MAGIC_START_5[] = "MI5-0005";
struct sub_index_data {
char magic[MAGIC_SIZE]; /* MAGIC_START_5 */
u64 volume_nonce;
u64 virtual_chapter_low;
u64 virtual_chapter_high;
u32 first_list;
u32 list_count;
};
static const char MAGIC_START_6[] = "MI6-0001";
struct volume_index_data {
char magic[MAGIC_SIZE]; /* MAGIC_START_6 */
u32 sparse_sample_rate;
};
static inline u32 extract_address(const struct volume_sub_index *sub_index,
const struct uds_record_name *name)
{
return uds_extract_volume_index_bytes(name) & sub_index->address_mask;
}
static inline u32 extract_dlist_num(const struct volume_sub_index *sub_index,
const struct uds_record_name *name)
{
u64 bits = uds_extract_volume_index_bytes(name);
return (bits >> sub_index->address_bits) % sub_index->list_count;
}
static inline const struct volume_sub_index_zone *
get_zone_for_record(const struct volume_index_record *record)
{
return &record->sub_index->zones[record->zone_number];
}
static inline u64 convert_index_to_virtual(const struct volume_index_record *record,
u32 index_chapter)
{
const struct volume_sub_index_zone *volume_index_zone = get_zone_for_record(record);
u32 rolling_chapter = ((index_chapter - volume_index_zone->virtual_chapter_low) &
record->sub_index->chapter_mask);
return volume_index_zone->virtual_chapter_low + rolling_chapter;
}
static inline u32 convert_virtual_to_index(const struct volume_sub_index *sub_index,
u64 virtual_chapter)
{
return virtual_chapter & sub_index->chapter_mask;
}
Annotation
- Immediate include surface: `volume-index.h`, `linux/bitops.h`, `linux/bits.h`, `linux/cache.h`, `linux/compiler.h`, `linux/log2.h`, `errors.h`, `logger.h`.
- Detected declarations: `struct sub_index_parameters`, `struct split_config`, `struct chapter_range`, `struct sub_index_data`, `struct volume_index_data`, `function extract_address`, `function extract_dlist_num`, `function get_zone_for_record`, `function convert_index_to_virtual`, `function convert_virtual_to_index`.
- 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.