#include <linux/highmem.h>
#include <linux/debugfs.h>
#include <linux/blkdev.h>
#include <linux/blk-integrity.h>
#include <linux/pagemap.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/hdreg.h>
#include <linux/sizes.h>
#include <linux/ndctl.h>
#include <linux/fs.h>
#include <linux/nd.h>
#include <linux/backing-dev.h>
#include <linux/cleanup.h>
#include "btt.h"
#include "nd.h"
enum log_ent_request { … };
static struct device *to_dev(struct arena_info *arena)
{ … }
static u64 adjust_initial_offset(struct nd_btt *nd_btt, u64 offset)
{ … }
static int arena_read_bytes(struct arena_info *arena, resource_size_t offset,
void *buf, size_t n, unsigned long flags)
{ … }
static int arena_write_bytes(struct arena_info *arena, resource_size_t offset,
void *buf, size_t n, unsigned long flags)
{ … }
static int btt_info_write(struct arena_info *arena, struct btt_sb *super)
{ … }
static int btt_info_read(struct arena_info *arena, struct btt_sb *super)
{ … }
static int __btt_map_write(struct arena_info *arena, u32 lba, __le32 mapping,
unsigned long flags)
{ … }
static int btt_map_write(struct arena_info *arena, u32 lba, u32 mapping,
u32 z_flag, u32 e_flag, unsigned long rwb_flags)
{ … }
static int btt_map_read(struct arena_info *arena, u32 lba, u32 *mapping,
int *trim, int *error, unsigned long rwb_flags)
{ … }
static int btt_log_group_read(struct arena_info *arena, u32 lane,
struct log_group *log)
{ … }
static struct dentry *debugfs_root;
static void arena_debugfs_init(struct arena_info *a, struct dentry *parent,
int idx)
{ … }
static void btt_debugfs_init(struct btt *btt)
{ … }
static u32 log_seq(struct log_group *log, int log_idx)
{ … }
static int btt_log_get_old(struct arena_info *a, struct log_group *log)
{ … }
static int btt_log_read(struct arena_info *arena, u32 lane,
struct log_entry *ent, int old_flag)
{ … }
static int __btt_log_write(struct arena_info *arena, u32 lane,
u32 sub, struct log_entry *ent, unsigned long flags)
{ … }
static int btt_flog_write(struct arena_info *arena, u32 lane, u32 sub,
struct log_entry *ent)
{ … }
static int btt_map_init(struct arena_info *arena)
{ … }
static int btt_log_init(struct arena_info *arena)
{ … }
static u64 to_namespace_offset(struct arena_info *arena, u64 lba)
{ … }
static int arena_clear_freelist_error(struct arena_info *arena, u32 lane)
{ … }
static int btt_freelist_init(struct arena_info *arena)
{ … }
static bool ent_is_padding(struct log_entry *ent)
{ … }
static int log_set_indices(struct arena_info *arena)
{ … }
static int btt_rtt_init(struct arena_info *arena)
{ … }
static int btt_maplocks_init(struct arena_info *arena)
{ … }
static struct arena_info *alloc_arena(struct btt *btt, size_t size,
size_t start, size_t arena_off)
{ … }
static void free_arenas(struct btt *btt)
{ … }
static void parse_arena_meta(struct arena_info *arena, struct btt_sb *super,
u64 arena_off)
{ … }
static int discover_arenas(struct btt *btt)
{ … }
static int create_arenas(struct btt *btt)
{ … }
static int btt_arena_write_layout(struct arena_info *arena)
{ … }
static int btt_meta_init(struct btt *btt)
{ … }
static u32 btt_meta_size(struct btt *btt)
{ … }
static int lba_to_arena(struct btt *btt, sector_t sector, __u32 *premap,
struct arena_info **arena)
{ … }
static void lock_map(struct arena_info *arena, u32 premap)
__acquires(&arena->map_locks[idx].lock)
{ … }
static void unlock_map(struct arena_info *arena, u32 premap)
__releases(&arena->map_locks[idx].lock)
{ … }
static int btt_data_read(struct arena_info *arena, struct page *page,
unsigned int off, u32 lba, u32 len)
{ … }
static int btt_data_write(struct arena_info *arena, u32 lba,
struct page *page, unsigned int off, u32 len)
{ … }
static void zero_fill_data(struct page *page, unsigned int off, u32 len)
{ … }
#ifdef CONFIG_BLK_DEV_INTEGRITY
static int btt_rw_integrity(struct btt *btt, struct bio_integrity_payload *bip,
struct arena_info *arena, u32 postmap, int rw)
{ … }
#else
static int btt_rw_integrity(struct btt *btt, struct bio_integrity_payload *bip,
struct arena_info *arena, u32 postmap, int rw)
{
return 0;
}
#endif
static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip,
struct page *page, unsigned int off, sector_t sector,
unsigned int len)
{ … }
static bool btt_is_badblock(struct btt *btt, struct arena_info *arena,
u32 postmap)
{ … }
static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip,
sector_t sector, struct page *page, unsigned int off,
unsigned int len)
{ … }
static int btt_do_bvec(struct btt *btt, struct bio_integrity_payload *bip,
struct page *page, unsigned int len, unsigned int off,
enum req_op op, sector_t sector)
{ … }
static void btt_submit_bio(struct bio *bio)
{ … }
static int btt_getgeo(struct block_device *bd, struct hd_geometry *geo)
{ … }
static const struct block_device_operations btt_fops = …;
static int btt_blk_init(struct btt *btt)
{ … }
static void btt_blk_cleanup(struct btt *btt)
{ … }
static struct btt *btt_init(struct nd_btt *nd_btt, unsigned long long rawsize,
u32 lbasize, uuid_t *uuid,
struct nd_region *nd_region)
{ … }
static void btt_fini(struct btt *btt)
{ … }
int nvdimm_namespace_attach_btt(struct nd_namespace_common *ndns)
{ … }
EXPORT_SYMBOL(…);
int nvdimm_namespace_detach_btt(struct nd_btt *nd_btt)
{ … }
EXPORT_SYMBOL(…);
static int __init nd_btt_init(void)
{ … }
static void __exit nd_btt_exit(void)
{ … }
MODULE_ALIAS_ND_DEVICE(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(nd_btt_exit);