#include "dm-space-map-common.h"
#include "dm-transaction-manager.h"
#include "dm-btree-internal.h"
#include "dm-persistent-data-internal.h"
#include <linux/bitops.h>
#include <linux/device-mapper.h>
#define DM_MSG_PREFIX …
#define INDEX_CSUM_XOR …
static void index_prepare_for_write(const struct dm_block_validator *v,
struct dm_block *b,
size_t block_size)
{ … }
static int index_check(const struct dm_block_validator *v,
struct dm_block *b,
size_t block_size)
{ … }
static const struct dm_block_validator index_validator = …;
#define BITMAP_CSUM_XOR …
static void dm_bitmap_prepare_for_write(const struct dm_block_validator *v,
struct dm_block *b,
size_t block_size)
{ … }
static int dm_bitmap_check(const struct dm_block_validator *v,
struct dm_block *b,
size_t block_size)
{ … }
static const struct dm_block_validator dm_sm_bitmap_validator = …;
#define ENTRIES_PER_WORD …
#define ENTRIES_SHIFT …
static void *dm_bitmap_data(struct dm_block *b)
{ … }
#define WORD_MASK_HIGH …
static unsigned int dm_bitmap_word_used(void *addr, unsigned int b)
{ … }
static unsigned int sm_lookup_bitmap(void *addr, unsigned int b)
{ … }
static void sm_set_bitmap(void *addr, unsigned int b, unsigned int val)
{ … }
static int sm_find_free(void *addr, unsigned int begin, unsigned int end,
unsigned int *result)
{ … }
static int sm_ll_init(struct ll_disk *ll, struct dm_transaction_manager *tm)
{ … }
int sm_ll_extend(struct ll_disk *ll, dm_block_t extra_blocks)
{ … }
int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result)
{ … }
static int sm_ll_lookup_big_ref_count(struct ll_disk *ll, dm_block_t b,
uint32_t *result)
{ … }
int sm_ll_lookup(struct ll_disk *ll, dm_block_t b, uint32_t *result)
{ … }
int sm_ll_find_free_block(struct ll_disk *ll, dm_block_t begin,
dm_block_t end, dm_block_t *result)
{ … }
int sm_ll_find_common_free_block(struct ll_disk *old_ll, struct ll_disk *new_ll,
dm_block_t begin, dm_block_t end, dm_block_t *b)
{ … }
int sm_ll_insert(struct ll_disk *ll, dm_block_t b,
uint32_t ref_count, int32_t *nr_allocations)
{ … }
struct inc_context { … };
static inline void init_inc_context(struct inc_context *ic)
{ … }
static inline void exit_inc_context(struct ll_disk *ll, struct inc_context *ic)
{ … }
static inline void reset_inc_context(struct ll_disk *ll, struct inc_context *ic)
{ … }
static bool contains_key(struct btree_node *n, uint64_t key, int index)
{ … }
static int __sm_ll_inc_overflow(struct ll_disk *ll, dm_block_t b, struct inc_context *ic)
{ … }
static int sm_ll_inc_overflow(struct ll_disk *ll, dm_block_t b, struct inc_context *ic)
{ … }
static inline int shadow_bitmap(struct ll_disk *ll, struct inc_context *ic)
{ … }
static inline int ensure_bitmap(struct ll_disk *ll, struct inc_context *ic)
{ … }
static inline int sm_ll_inc_bitmap(struct ll_disk *ll, dm_block_t b,
uint32_t bit, uint32_t bit_end,
int32_t *nr_allocations, dm_block_t *new_b,
struct inc_context *ic)
{ … }
static int __sm_ll_inc(struct ll_disk *ll, dm_block_t b, dm_block_t e,
int32_t *nr_allocations, dm_block_t *new_b)
{ … }
int sm_ll_inc(struct ll_disk *ll, dm_block_t b, dm_block_t e,
int32_t *nr_allocations)
{ … }
static int __sm_ll_del_overflow(struct ll_disk *ll, dm_block_t b,
struct inc_context *ic)
{ … }
static int __sm_ll_dec_overflow(struct ll_disk *ll, dm_block_t b,
struct inc_context *ic, uint32_t *old_rc)
{ … }
static int sm_ll_dec_overflow(struct ll_disk *ll, dm_block_t b,
struct inc_context *ic, uint32_t *old_rc)
{ … }
static inline int sm_ll_dec_bitmap(struct ll_disk *ll, dm_block_t b,
uint32_t bit, uint32_t bit_end,
struct inc_context *ic,
int32_t *nr_allocations, dm_block_t *new_b)
{ … }
static int __sm_ll_dec(struct ll_disk *ll, dm_block_t b, dm_block_t e,
int32_t *nr_allocations, dm_block_t *new_b)
{ … }
int sm_ll_dec(struct ll_disk *ll, dm_block_t b, dm_block_t e,
int32_t *nr_allocations)
{ … }
int sm_ll_commit(struct ll_disk *ll)
{ … }
static int metadata_ll_load_ie(struct ll_disk *ll, dm_block_t index,
struct disk_index_entry *ie)
{ … }
static int metadata_ll_save_ie(struct ll_disk *ll, dm_block_t index,
struct disk_index_entry *ie)
{ … }
static int metadata_ll_init_index(struct ll_disk *ll)
{ … }
static int metadata_ll_open(struct ll_disk *ll)
{ … }
static dm_block_t metadata_ll_max_entries(struct ll_disk *ll)
{ … }
static int metadata_ll_commit(struct ll_disk *ll)
{ … }
int sm_ll_new_metadata(struct ll_disk *ll, struct dm_transaction_manager *tm)
{ … }
int sm_ll_open_metadata(struct ll_disk *ll, struct dm_transaction_manager *tm,
void *root_le, size_t len)
{ … }
static inline int ie_cache_writeback(struct ll_disk *ll, struct ie_cache *iec)
{ … }
static inline unsigned int hash_index(dm_block_t index)
{ … }
static int disk_ll_load_ie(struct ll_disk *ll, dm_block_t index,
struct disk_index_entry *ie)
{ … }
static int disk_ll_save_ie(struct ll_disk *ll, dm_block_t index,
struct disk_index_entry *ie)
{ … }
static int disk_ll_init_index(struct ll_disk *ll)
{ … }
static int disk_ll_open(struct ll_disk *ll)
{ … }
static dm_block_t disk_ll_max_entries(struct ll_disk *ll)
{ … }
static int disk_ll_commit(struct ll_disk *ll)
{ … }
int sm_ll_new_disk(struct ll_disk *ll, struct dm_transaction_manager *tm)
{ … }
int sm_ll_open_disk(struct ll_disk *ll, struct dm_transaction_manager *tm,
void *root_le, size_t len)
{ … }