#include "dm-array.h"
#include "dm-space-map.h"
#include "dm-transaction-manager.h"
#include <linux/export.h>
#include <linux/device-mapper.h>
#define DM_MSG_PREFIX …
struct array_block { … } __packed;
#define CSUM_XOR …
static void array_block_prepare_for_write(const struct dm_block_validator *v,
struct dm_block *b,
size_t size_of_block)
{ … }
static int array_block_check(const struct dm_block_validator *v,
struct dm_block *b,
size_t size_of_block)
{ … }
static const struct dm_block_validator array_validator = …;
static void *element_at(struct dm_array_info *info, struct array_block *ab,
unsigned int index)
{ … }
static void on_entries(struct dm_array_info *info, struct array_block *ab,
void (*fn)(void *, const void *, unsigned int))
{ … }
static void inc_ablock_entries(struct dm_array_info *info, struct array_block *ab)
{ … }
static void dec_ablock_entries(struct dm_array_info *info, struct array_block *ab)
{ … }
static uint32_t calc_max_entries(size_t value_size, size_t size_of_block)
{ … }
static int alloc_ablock(struct dm_array_info *info, size_t size_of_block,
uint32_t max_entries,
struct dm_block **block, struct array_block **ab)
{ … }
static void fill_ablock(struct dm_array_info *info, struct array_block *ab,
const void *value, unsigned int new_nr)
{ … }
static void trim_ablock(struct dm_array_info *info, struct array_block *ab,
unsigned int new_nr)
{ … }
static int get_ablock(struct dm_array_info *info, dm_block_t b,
struct dm_block **block, struct array_block **ab)
{ … }
static void unlock_ablock(struct dm_array_info *info, struct dm_block *block)
{ … }
static int lookup_ablock(struct dm_array_info *info, dm_block_t root,
unsigned int index, struct dm_block **block,
struct array_block **ab)
{ … }
static int insert_ablock(struct dm_array_info *info, uint64_t index,
struct dm_block *block, dm_block_t *root)
{ … }
static int __shadow_ablock(struct dm_array_info *info, dm_block_t b,
struct dm_block **block, struct array_block **ab)
{ … }
static int __reinsert_ablock(struct dm_array_info *info, unsigned int index,
struct dm_block *block, dm_block_t b,
dm_block_t *root)
{ … }
static int shadow_ablock(struct dm_array_info *info, dm_block_t *root,
unsigned int index, struct dm_block **block,
struct array_block **ab)
{ … }
static int insert_new_ablock(struct dm_array_info *info, size_t size_of_block,
uint32_t max_entries,
unsigned int block_index, uint32_t nr,
const void *value, dm_block_t *root)
{ … }
static int insert_full_ablocks(struct dm_array_info *info, size_t size_of_block,
unsigned int begin_block, unsigned int end_block,
unsigned int max_entries, const void *value,
dm_block_t *root)
{ … }
struct resize { … };
static int drop_blocks(struct resize *resize, unsigned int begin_index,
unsigned int end_index)
{ … }
static unsigned int total_nr_blocks_needed(unsigned int nr_full_blocks,
unsigned int nr_entries_in_last_block)
{ … }
static int shrink(struct resize *resize)
{ … }
static int grow_extend_tail_block(struct resize *resize, uint32_t new_nr_entries)
{ … }
static int grow_add_tail_block(struct resize *resize)
{ … }
static int grow_needs_more_blocks(struct resize *resize)
{ … }
static int grow(struct resize *resize)
{ … }
static void block_inc(void *context, const void *value, unsigned int count)
{ … }
static void __block_dec(void *context, const void *value)
{ … }
static void block_dec(void *context, const void *value, unsigned int count)
{ … }
static int block_equal(void *context, const void *value1, const void *value2)
{ … }
void dm_array_info_init(struct dm_array_info *info,
struct dm_transaction_manager *tm,
struct dm_btree_value_type *vt)
{ … }
EXPORT_SYMBOL_GPL(…);
int dm_array_empty(struct dm_array_info *info, dm_block_t *root)
{ … }
EXPORT_SYMBOL_GPL(…);
static int array_resize(struct dm_array_info *info, dm_block_t root,
uint32_t old_size, uint32_t new_size,
const void *value, dm_block_t *new_root)
{ … }
int dm_array_resize(struct dm_array_info *info, dm_block_t root,
uint32_t old_size, uint32_t new_size,
const void *value, dm_block_t *new_root)
__dm_written_to_disk(value)
{ … }
EXPORT_SYMBOL_GPL(…);
static int populate_ablock_with_values(struct dm_array_info *info, struct array_block *ab,
value_fn fn, void *context,
unsigned int base, unsigned int new_nr)
{ … }
int dm_array_new(struct dm_array_info *info, dm_block_t *root,
uint32_t size, value_fn fn, void *context)
{ … }
EXPORT_SYMBOL_GPL(…);
int dm_array_del(struct dm_array_info *info, dm_block_t root)
{ … }
EXPORT_SYMBOL_GPL(…);
int dm_array_get_value(struct dm_array_info *info, dm_block_t root,
uint32_t index, void *value_le)
{ … }
EXPORT_SYMBOL_GPL(…);
static int array_set_value(struct dm_array_info *info, dm_block_t root,
uint32_t index, const void *value, dm_block_t *new_root)
{ … }
int dm_array_set_value(struct dm_array_info *info, dm_block_t root,
uint32_t index, const void *value, dm_block_t *new_root)
__dm_written_to_disk(value)
{ … }
EXPORT_SYMBOL_GPL(…);
struct walk_info { … };
static int walk_ablock(void *context, uint64_t *keys, void *leaf)
{ … }
int dm_array_walk(struct dm_array_info *info, dm_block_t root,
int (*fn)(void *, uint64_t key, void *leaf),
void *context)
{ … }
EXPORT_SYMBOL_GPL(…);
static int load_ablock(struct dm_array_cursor *c)
{ … }
int dm_array_cursor_begin(struct dm_array_info *info, dm_block_t root,
struct dm_array_cursor *c)
{ … }
EXPORT_SYMBOL_GPL(…);
void dm_array_cursor_end(struct dm_array_cursor *c)
{ … }
EXPORT_SYMBOL_GPL(…);
int dm_array_cursor_next(struct dm_array_cursor *c)
{ … }
EXPORT_SYMBOL_GPL(…);
int dm_array_cursor_skip(struct dm_array_cursor *c, uint32_t count)
{ … }
EXPORT_SYMBOL_GPL(…);
void dm_array_cursor_get_value(struct dm_array_cursor *c, void **value_le)
{ … }
EXPORT_SYMBOL_GPL(…);