drm/rockchip: Don't change hdmi reference clock rate
[drm/drm-misc.git] / drivers / md / dm-vdo / indexer / config.h
blob08507dc2f7a14723e9b28aa098057332ef878be0
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright 2023 Red Hat
4 */
6 #ifndef UDS_CONFIG_H
7 #define UDS_CONFIG_H
9 #include "geometry.h"
10 #include "indexer.h"
11 #include "io-factory.h"
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.
19 enum {
20 DEFAULT_VOLUME_INDEX_MEAN_DELTA = 4096,
21 DEFAULT_CACHE_CHAPTERS = 7,
22 DEFAULT_SPARSE_SAMPLE_RATE = 32,
23 MAX_ZONES = 16,
26 /* A set of configuration parameters for the indexer. */
27 struct uds_configuration {
28 /* Storage device for the index */
29 struct block_device *bdev;
31 /* The maximum allowable size of the index */
32 size_t size;
34 /* The offset where the index should start */
35 off_t offset;
37 /* Parameters for the volume */
39 /* The volume layout */
40 struct index_geometry *geometry;
42 /* Index owner's nonce */
43 u64 nonce;
45 /* The number of threads used to process index requests */
46 unsigned int zone_count;
48 /* The number of threads used to read volume pages */
49 unsigned int read_threads;
51 /* Size of the page cache and sparse chapter index cache in chapters */
52 u32 cache_chapters;
54 /* Parameters for the volume index */
56 /* The mean delta for the volume index */
57 u32 volume_index_mean_delta;
59 /* Sampling rate for sparse indexing */
60 u32 sparse_sample_rate;
63 /* On-disk structure of data for a version 8.02 index. */
64 struct 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;
89 /* On-disk structure of data for a version 6.02 index. */
90 struct 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;
111 int __must_check uds_make_configuration(const struct uds_parameters *params,
112 struct uds_configuration **config_ptr);
114 void uds_free_configuration(struct uds_configuration *config);
116 int __must_check uds_validate_config_contents(struct buffered_reader *reader,
117 struct uds_configuration *config);
119 int __must_check uds_write_config_contents(struct buffered_writer *writer,
120 struct uds_configuration *config, u32 version);
122 void uds_log_configuration(struct uds_configuration *config);
124 #endif /* UDS_CONFIG_H */