File Index
Files and directories
Sign in
FILE

config.h

File preview with syntax highlighting.

linux-6.19.14/drivers/md/dm-vdo/indexer/config.h C
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright 2023 Red Hat
  4 */
  5
  6#ifndef UDS_CONFIG_H
  7#define UDS_CONFIG_H
  8
  9#include "geometry.h"
 10#include "indexer.h"
 11#include "io-factory.h"
 12
 13/*
 14 * The uds_configuration records a variety of parameters used to configure a new UDS index. Some
 15 * parameters are provided by the client, while others are fixed or derived from user-supplied
 16 * values. It is created when an index is created, and it is recorded in the index metadata.
 17 */
 18
 19enum {
 20	DEFAULT_VOLUME_INDEX_MEAN_DELTA = 4096,
 21	DEFAULT_CACHE_CHAPTERS = 7,
 22	DEFAULT_SPARSE_SAMPLE_RATE = 32,
 23	MAX_ZONES = 16,
 24};
 25
 26/* A set of configuration parameters for the indexer. */
 27struct uds_configuration {
 28	/* Storage device for the index */
 29	struct block_device *bdev;
 30
 31	/* The maximum allowable size of the index */
 32	size_t size;
 33
 34	/* The offset where the index should start */
 35	off_t offset;
 36
 37	/* Parameters for the volume */
 38
 39	/* The volume layout */
 40	struct index_geometry *geometry;
 41
 42	/* Index owner's nonce */
 43	u64 nonce;
 44
 45	/* The number of threads used to process index requests */
 46	unsigned int zone_count;
 47
 48	/* The number of threads used to read volume pages */
 49	unsigned int read_threads;
 50
 51	/* Size of the page cache and sparse chapter index cache in chapters */
 52	u32 cache_chapters;
 53
 54	/* Parameters for the volume index */
 55
 56	/* The mean delta for the volume index */
 57	u32 volume_index_mean_delta;
 58
 59	/* Sampling rate for sparse indexing */
 60	u32 sparse_sample_rate;
 61};
 62
 63/* On-disk structure of data for a version 8.02 index. */
 64struct uds_configuration_8_02 {
 65	/* Smaller (16), Small (64) or large (256) indices */
 66	u32 record_pages_per_chapter;
 67	/* Total number of chapters per volume */
 68	u32 chapters_per_volume;
 69	/* Number of sparse chapters per volume */
 70	u32 sparse_chapters_per_volume;
 71	/* Size of the page cache, in chapters */
 72	u32 cache_chapters;
 73	/* Unused field */
 74	u32 unused;
 75	/* The volume index mean delta to use */
 76	u32 volume_index_mean_delta;
 77	/* Size of a page, used for both record pages and index pages */
 78	u32 bytes_per_page;
 79	/* Sampling rate for sparse indexing */
 80	u32 sparse_sample_rate;
 81	/* Index owner's nonce */
 82	u64 nonce;
 83	/* Virtual chapter remapped from physical chapter 0 */
 84	u64 remapped_virtual;
 85	/* New physical chapter which remapped chapter was moved to */
 86	u64 remapped_physical;
 87} __packed;
 88
 89/* On-disk structure of data for a version 6.02 index. */
 90struct uds_configuration_6_02 {
 91	/* Smaller (16), Small (64) or large (256) indices */
 92	u32 record_pages_per_chapter;
 93	/* Total number of chapters per volume */
 94	u32 chapters_per_volume;
 95	/* Number of sparse chapters per volume */
 96	u32 sparse_chapters_per_volume;
 97	/* Size of the page cache, in chapters */
 98	u32 cache_chapters;
 99	/* Unused field */
100	u32 unused;
101	/* The volume index mean delta to use */
102	u32 volume_index_mean_delta;
103	/* Size of a page, used for both record pages and index pages */
104	u32 bytes_per_page;
105	/* Sampling rate for sparse indexing */
106	u32 sparse_sample_rate;
107	/* Index owner's nonce */
108	u64 nonce;
109} __packed;
110
111int __must_check uds_make_configuration(const struct uds_parameters *params,
112					struct uds_configuration **config_ptr);
113
114void uds_free_configuration(struct uds_configuration *config);
115
116int __must_check uds_validate_config_contents(struct buffered_reader *reader,
117					      struct uds_configuration *config);
118
119int __must_check uds_write_config_contents(struct buffered_writer *writer,
120					   struct uds_configuration *config, u32 version);
121
122void uds_log_configuration(struct uds_configuration *config);
123
124#endif /* UDS_CONFIG_H */
~/ Read-only file preview.