drivers/md/dm-vdo/indexer/config.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/indexer/config.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/indexer/config.c- Extension
.c- Size
- 13089 bytes
- Lines
- 377
- 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
config.hlogger.hmemory-alloc.hnumeric.hstring-utils.hthread-utils.h
Detected Declarations
function is_versionfunction are_matching_configurationsfunction uds_validate_config_contentsfunction uds_write_config_contentsfunction compute_memory_sizesfunction normalize_zone_countfunction normalize_read_threadsfunction uds_make_configurationfunction uds_free_configurationfunction uds_log_configuration
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2023 Red Hat
*/
#include "config.h"
#include "logger.h"
#include "memory-alloc.h"
#include "numeric.h"
#include "string-utils.h"
#include "thread-utils.h"
static const u8 INDEX_CONFIG_MAGIC[] = "ALBIC";
static const u8 INDEX_CONFIG_VERSION_6_02[] = "06.02";
static const u8 INDEX_CONFIG_VERSION_8_02[] = "08.02";
#define DEFAULT_VOLUME_READ_THREADS 2
#define MAX_VOLUME_READ_THREADS 16
#define INDEX_CONFIG_MAGIC_LENGTH (sizeof(INDEX_CONFIG_MAGIC) - 1)
#define INDEX_CONFIG_VERSION_LENGTH ((int)(sizeof(INDEX_CONFIG_VERSION_6_02) - 1))
static bool is_version(const u8 *version, u8 *buffer)
{
return memcmp(version, buffer, INDEX_CONFIG_VERSION_LENGTH) == 0;
}
static bool are_matching_configurations(struct uds_configuration *saved_config,
struct index_geometry *saved_geometry,
struct uds_configuration *user)
{
struct index_geometry *geometry = user->geometry;
bool result = true;
if (saved_geometry->record_pages_per_chapter != geometry->record_pages_per_chapter) {
vdo_log_error("Record pages per chapter (%u) does not match (%u)",
saved_geometry->record_pages_per_chapter,
geometry->record_pages_per_chapter);
result = false;
}
if (saved_geometry->chapters_per_volume != geometry->chapters_per_volume) {
vdo_log_error("Chapter count (%u) does not match (%u)",
saved_geometry->chapters_per_volume,
geometry->chapters_per_volume);
result = false;
}
if (saved_geometry->sparse_chapters_per_volume != geometry->sparse_chapters_per_volume) {
vdo_log_error("Sparse chapter count (%u) does not match (%u)",
saved_geometry->sparse_chapters_per_volume,
geometry->sparse_chapters_per_volume);
result = false;
}
if (saved_config->cache_chapters != user->cache_chapters) {
vdo_log_error("Cache size (%u) does not match (%u)",
saved_config->cache_chapters, user->cache_chapters);
result = false;
}
if (saved_config->volume_index_mean_delta != user->volume_index_mean_delta) {
vdo_log_error("Volume index mean delta (%u) does not match (%u)",
saved_config->volume_index_mean_delta,
user->volume_index_mean_delta);
result = false;
}
if (saved_geometry->bytes_per_page != geometry->bytes_per_page) {
vdo_log_error("Bytes per page value (%zu) does not match (%zu)",
saved_geometry->bytes_per_page, geometry->bytes_per_page);
result = false;
}
if (saved_config->sparse_sample_rate != user->sparse_sample_rate) {
vdo_log_error("Sparse sample rate (%u) does not match (%u)",
saved_config->sparse_sample_rate,
user->sparse_sample_rate);
result = false;
}
if (saved_config->nonce != user->nonce) {
vdo_log_error("Nonce (%llu) does not match (%llu)",
(unsigned long long) saved_config->nonce,
(unsigned long long) user->nonce);
result = false;
}
return result;
}
Annotation
- Immediate include surface: `config.h`, `logger.h`, `memory-alloc.h`, `numeric.h`, `string-utils.h`, `thread-utils.h`.
- Detected declarations: `function is_version`, `function are_matching_configurations`, `function uds_validate_config_contents`, `function uds_write_config_contents`, `function compute_memory_sizes`, `function normalize_zone_count`, `function normalize_read_threads`, `function uds_make_configuration`, `function uds_free_configuration`, `function uds_log_configuration`.
- 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.