xref: /linux/drivers/md/dm-vdo/indexer/index-layout.h (revision c02ce1735b150cf7c3b43790b48e23dcd17c0d46)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright 2023 Red Hat
4  */
5 
6 #ifndef UDS_INDEX_LAYOUT_H
7 #define UDS_INDEX_LAYOUT_H
8 
9 #include "config.h"
10 #include "indexer.h"
11 #include "io-factory.h"
12 
13 /*
14  * The index layout describes the format of the index on the underlying storage, and is responsible
15  * for creating those structures when the index is first created. It also validates the index data
16  * when loading a saved index, and updates it when saving the index.
17  */
18 
19 struct index_layout;
20 
21 int __must_check uds_make_index_layout(struct uds_configuration *config, bool new_layout,
22 				       struct index_layout **layout_ptr);
23 
24 void uds_free_index_layout(struct index_layout *layout);
25 
26 int __must_check uds_replace_index_layout_storage(struct index_layout *layout,
27 						  struct block_device *bdev);
28 
29 int __must_check uds_load_index_state(struct index_layout *layout,
30 				      struct uds_index *index);
31 
32 int __must_check uds_save_index_state(struct index_layout *layout,
33 				      struct uds_index *index);
34 
35 int __must_check uds_discard_open_chapter(struct index_layout *layout);
36 
37 u64 __must_check uds_get_volume_nonce(struct index_layout *layout);
38 
39 int __must_check uds_open_volume_bufio(struct index_layout *layout, size_t block_size,
40 				       unsigned int reserved_buffers,
41 				       struct dm_bufio_client **client_ptr);
42 
43 #endif /* UDS_INDEX_LAYOUT_H */
44