#include "dm-block-manager.h"
#include "dm-persistent-data-internal.h"
#include <linux/dm-bufio.h>
#include <linux/crc32c.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/rwsem.h>
#include <linux/device-mapper.h>
#include <linux/stacktrace.h>
#include <linux/sched/task.h>
#define DM_MSG_PREFIX …
#ifdef CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING
#define MAX_HOLDERS …
#define MAX_STACK …
struct stack_store { … };
struct block_lock { … };
struct waiter { … };
static unsigned int __find_holder(struct block_lock *lock,
struct task_struct *task)
{ … }
static void __add_holder(struct block_lock *lock, struct task_struct *task)
{ … }
static void __del_holder(struct block_lock *lock, struct task_struct *task)
{ … }
static int __check_holder(struct block_lock *lock)
{ … }
static void __wait(struct waiter *w)
{ … }
static void __wake_waiter(struct waiter *w)
{ … }
static void __wake_many(struct block_lock *lock)
{ … }
static void bl_init(struct block_lock *lock)
{ … }
static int __available_for_read(struct block_lock *lock)
{ … }
static int bl_down_read(struct block_lock *lock)
{ … }
static int bl_down_read_nonblock(struct block_lock *lock)
{ … }
static void bl_up_read(struct block_lock *lock)
{ … }
static int bl_down_write(struct block_lock *lock)
{ … }
static void bl_up_write(struct block_lock *lock)
{ … }
static void report_recursive_bug(dm_block_t b, int r)
{ … }
#else
#define bl_init …
#define bl_down_read …
#define bl_down_read_nonblock …
#define bl_up_read …
#define bl_down_write …
#define bl_up_write …
#define report_recursive_bug …
#endif
static struct dm_buffer *to_buffer(struct dm_block *b)
{ … }
dm_block_t dm_block_location(struct dm_block *b)
{ … }
EXPORT_SYMBOL_GPL(…);
void *dm_block_data(struct dm_block *b)
{ … }
EXPORT_SYMBOL_GPL(…);
struct buffer_aux { … };
static void dm_block_manager_alloc_callback(struct dm_buffer *buf)
{ … }
static void dm_block_manager_write_callback(struct dm_buffer *buf)
{ … }
struct dm_block_manager { … };
struct dm_block_manager *dm_block_manager_create(struct block_device *bdev,
unsigned int block_size,
unsigned int max_held_per_thread)
{ … }
EXPORT_SYMBOL_GPL(…);
void dm_block_manager_destroy(struct dm_block_manager *bm)
{ … }
EXPORT_SYMBOL_GPL(…);
void dm_block_manager_reset(struct dm_block_manager *bm)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int dm_bm_block_size(struct dm_block_manager *bm)
{ … }
EXPORT_SYMBOL_GPL(…);
dm_block_t dm_bm_nr_blocks(struct dm_block_manager *bm)
{ … }
static int dm_bm_validate_buffer(struct dm_block_manager *bm,
struct dm_buffer *buf,
struct buffer_aux *aux,
const struct dm_block_validator *v)
{ … }
int dm_bm_read_lock(struct dm_block_manager *bm, dm_block_t b,
const struct dm_block_validator *v,
struct dm_block **result)
{ … }
EXPORT_SYMBOL_GPL(…);
int dm_bm_write_lock(struct dm_block_manager *bm,
dm_block_t b, const struct dm_block_validator *v,
struct dm_block **result)
{ … }
EXPORT_SYMBOL_GPL(…);
int dm_bm_read_try_lock(struct dm_block_manager *bm,
dm_block_t b, const struct dm_block_validator *v,
struct dm_block **result)
{ … }
int dm_bm_write_lock_zero(struct dm_block_manager *bm,
dm_block_t b, const struct dm_block_validator *v,
struct dm_block **result)
{ … }
EXPORT_SYMBOL_GPL(…);
void dm_bm_unlock(struct dm_block *b)
{ … }
EXPORT_SYMBOL_GPL(…);
int dm_bm_flush(struct dm_block_manager *bm)
{ … }
EXPORT_SYMBOL_GPL(…);
void dm_bm_prefetch(struct dm_block_manager *bm, dm_block_t b)
{ … }
bool dm_bm_is_read_only(struct dm_block_manager *bm)
{ … }
EXPORT_SYMBOL_GPL(…);
void dm_bm_set_read_only(struct dm_block_manager *bm)
{ … }
EXPORT_SYMBOL_GPL(…);
void dm_bm_set_read_write(struct dm_block_manager *bm)
{ … }
EXPORT_SYMBOL_GPL(…);
u32 dm_bm_checksum(const void *data, size_t len, u32 init_xor)
{ … }
EXPORT_SYMBOL_GPL(…);
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;