linux/drivers/md/dm-vdo/indexer/geometry.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright 2023 Red Hat
 */

#ifndef UDS_INDEX_GEOMETRY_H
#define UDS_INDEX_GEOMETRY_H

#include "indexer.h"

/*
 * The index_geometry records parameters that define the layout of a UDS index volume, and the size and
 * shape of various index structures. It is created when the index is created, and is referenced by
 * many index sub-components.
 */

struct index_geometry {};

enum {};

int __must_check uds_make_index_geometry(size_t bytes_per_page, u32 record_pages_per_chapter,
					 u32 chapters_per_volume,
					 u32 sparse_chapters_per_volume, u64 remapped_virtual,
					 u64 remapped_physical,
					 struct index_geometry **geometry_ptr);

int __must_check uds_copy_index_geometry(struct index_geometry *source,
					 struct index_geometry **geometry_ptr);

void uds_free_index_geometry(struct index_geometry *geometry);

u32 __must_check uds_map_to_physical_chapter(const struct index_geometry *geometry,
					     u64 virtual_chapter);

/*
 * Check whether this geometry is reduced by a chapter. This will only be true if the volume was
 * converted from a non-lvm volume to an lvm volume.
 */
static inline bool __must_check
uds_is_reduced_index_geometry(const struct index_geometry *geometry)
{}

static inline bool __must_check
uds_is_sparse_index_geometry(const struct index_geometry *geometry)
{}

bool __must_check uds_has_sparse_chapters(const struct index_geometry *geometry,
					  u64 oldest_virtual_chapter,
					  u64 newest_virtual_chapter);

bool __must_check uds_is_chapter_sparse(const struct index_geometry *geometry,
					u64 oldest_virtual_chapter,
					u64 newest_virtual_chapter,
					u64 virtual_chapter_number);

u32 __must_check uds_chapters_to_expire(const struct index_geometry *geometry,
					u64 newest_chapter);

#endif /* UDS_INDEX_GEOMETRY_H */