#include "volume-index.h"
#include <linux/bitops.h>
#include <linux/bits.h>
#include <linux/cache.h>
#include <linux/compiler.h>
#include <linux/log2.h>
#include "errors.h"
#include "logger.h"
#include "memory-alloc.h"
#include "numeric.h"
#include "permassert.h"
#include "thread-utils.h"
#include "config.h"
#include "geometry.h"
#include "hash-utils.h"
#include "indexer.h"
struct sub_index_parameters { … };
struct split_config { … };
struct chapter_range { … };
#define MAGIC_SIZE …
static const char MAGIC_START_5[] = …;
struct sub_index_data { … };
static const char MAGIC_START_6[] = …;
struct volume_index_data { … };
static inline u32 extract_address(const struct volume_sub_index *sub_index,
const struct uds_record_name *name)
{ … }
static inline u32 extract_dlist_num(const struct volume_sub_index *sub_index,
const struct uds_record_name *name)
{ … }
static inline const struct volume_sub_index_zone *
get_zone_for_record(const struct volume_index_record *record)
{ … }
static inline u64 convert_index_to_virtual(const struct volume_index_record *record,
u32 index_chapter)
{ … }
static inline u32 convert_virtual_to_index(const struct volume_sub_index *sub_index,
u64 virtual_chapter)
{ … }
static inline bool is_virtual_chapter_indexed(const struct volume_index_record *record,
u64 virtual_chapter)
{ … }
static inline bool has_sparse(const struct volume_index *volume_index)
{ … }
bool uds_is_volume_index_sample(const struct volume_index *volume_index,
const struct uds_record_name *name)
{ … }
static inline const struct volume_sub_index *
get_volume_sub_index(const struct volume_index *volume_index,
const struct uds_record_name *name)
{ … }
static unsigned int get_volume_sub_index_zone(const struct volume_sub_index *sub_index,
const struct uds_record_name *name)
{ … }
unsigned int uds_get_volume_index_zone(const struct volume_index *volume_index,
const struct uds_record_name *name)
{ … }
#define DELTA_LIST_SIZE …
static int compute_volume_sub_index_parameters(const struct uds_configuration *config,
struct sub_index_parameters *params)
{ … }
static void uninitialize_volume_sub_index(struct volume_sub_index *sub_index)
{ … }
void uds_free_volume_index(struct volume_index *volume_index)
{ … }
static int compute_volume_sub_index_save_bytes(const struct uds_configuration *config,
size_t *bytes)
{ … }
static void split_configuration(const struct uds_configuration *config,
struct split_config *split)
{ … }
static int compute_volume_index_save_bytes(const struct uds_configuration *config,
size_t *bytes)
{ … }
int uds_compute_volume_index_save_blocks(const struct uds_configuration *config,
size_t block_size, u64 *block_count)
{ … }
static inline int flush_invalid_entries(struct volume_index_record *record,
struct chapter_range *flush_range,
u32 *next_chapter_to_invalidate)
{ … }
static int get_volume_index_entry(struct volume_index_record *record, u32 list_number,
u32 key, struct chapter_range *flush_range)
{ … }
static int get_volume_sub_index_record(struct volume_sub_index *sub_index,
const struct uds_record_name *name,
struct volume_index_record *record)
{ … }
int uds_get_volume_index_record(struct volume_index *volume_index,
const struct uds_record_name *name,
struct volume_index_record *record)
{ … }
int uds_put_volume_index_record(struct volume_index_record *record, u64 virtual_chapter)
{ … }
int uds_remove_volume_index_record(struct volume_index_record *record)
{ … }
static void set_volume_sub_index_zone_open_chapter(struct volume_sub_index *sub_index,
unsigned int zone_number,
u64 virtual_chapter)
{ … }
void uds_set_volume_index_zone_open_chapter(struct volume_index *volume_index,
unsigned int zone_number,
u64 virtual_chapter)
{ … }
void uds_set_volume_index_open_chapter(struct volume_index *volume_index,
u64 virtual_chapter)
{ … }
int uds_set_volume_index_record_chapter(struct volume_index_record *record,
u64 virtual_chapter)
{ … }
static u64 lookup_volume_sub_index_name(const struct volume_sub_index *sub_index,
const struct uds_record_name *name)
{ … }
u64 uds_lookup_volume_index_name(const struct volume_index *volume_index,
const struct uds_record_name *name)
{ … }
static void abort_restoring_volume_sub_index(struct volume_sub_index *sub_index)
{ … }
static void abort_restoring_volume_index(struct volume_index *volume_index)
{ … }
static int start_restoring_volume_sub_index(struct volume_sub_index *sub_index,
struct buffered_reader **readers,
unsigned int reader_count)
{ … }
static int start_restoring_volume_index(struct volume_index *volume_index,
struct buffered_reader **buffered_readers,
unsigned int reader_count)
{ … }
static int finish_restoring_volume_sub_index(struct volume_sub_index *sub_index,
struct buffered_reader **buffered_readers,
unsigned int reader_count)
{ … }
static int finish_restoring_volume_index(struct volume_index *volume_index,
struct buffered_reader **buffered_readers,
unsigned int reader_count)
{ … }
int uds_load_volume_index(struct volume_index *volume_index,
struct buffered_reader **readers, unsigned int reader_count)
{ … }
static int start_saving_volume_sub_index(const struct volume_sub_index *sub_index,
unsigned int zone_number,
struct buffered_writer *buffered_writer)
{ … }
static int start_saving_volume_index(const struct volume_index *volume_index,
unsigned int zone_number,
struct buffered_writer *writer)
{ … }
static int finish_saving_volume_sub_index(const struct volume_sub_index *sub_index,
unsigned int zone_number)
{ … }
static int finish_saving_volume_index(const struct volume_index *volume_index,
unsigned int zone_number)
{ … }
int uds_save_volume_index(struct volume_index *volume_index,
struct buffered_writer **writers, unsigned int writer_count)
{ … }
static void get_volume_sub_index_stats(const struct volume_sub_index *sub_index,
struct volume_index_stats *stats)
{ … }
void uds_get_volume_index_stats(const struct volume_index *volume_index,
struct volume_index_stats *stats)
{ … }
static int initialize_volume_sub_index(const struct uds_configuration *config,
u64 volume_nonce, u8 tag,
struct volume_sub_index *sub_index)
{ … }
int uds_make_volume_index(const struct uds_configuration *config, u64 volume_nonce,
struct volume_index **volume_index_ptr)
{ … }