#include "dm-zoned.h"
#include <linux/module.h>
#include <linux/crc32.h>
#include <linux/sched/mm.h>
#define DM_MSG_PREFIX …
#define DMZ_META_VER …
#define DMZ_MAGIC …
struct dmz_super { … };
struct dmz_map { … };
#define DMZ_MAP_ENTRIES …
#define DMZ_MAP_ENTRIES_SHIFT …
#define DMZ_MAP_ENTRIES_MASK …
#define DMZ_MAP_UNMAPPED …
struct dmz_mblock { … };
enum { … };
struct dmz_sb { … };
struct dmz_metadata { … };
#define dmz_zmd_info(zmd, format, args...) …
#define dmz_zmd_err(zmd, format, args...) …
#define dmz_zmd_warn(zmd, format, args...) …
#define dmz_zmd_debug(zmd, format, args...) …
static unsigned int dmz_dev_zone_id(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
sector_t dmz_start_sect(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
sector_t dmz_start_block(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
unsigned int dmz_zone_nr_blocks(struct dmz_metadata *zmd)
{ … }
unsigned int dmz_zone_nr_blocks_shift(struct dmz_metadata *zmd)
{ … }
unsigned int dmz_zone_nr_sectors(struct dmz_metadata *zmd)
{ … }
unsigned int dmz_zone_nr_sectors_shift(struct dmz_metadata *zmd)
{ … }
unsigned int dmz_nr_zones(struct dmz_metadata *zmd)
{ … }
unsigned int dmz_nr_chunks(struct dmz_metadata *zmd)
{ … }
unsigned int dmz_nr_rnd_zones(struct dmz_metadata *zmd, int idx)
{ … }
unsigned int dmz_nr_unmap_rnd_zones(struct dmz_metadata *zmd, int idx)
{ … }
unsigned int dmz_nr_cache_zones(struct dmz_metadata *zmd)
{ … }
unsigned int dmz_nr_unmap_cache_zones(struct dmz_metadata *zmd)
{ … }
unsigned int dmz_nr_seq_zones(struct dmz_metadata *zmd, int idx)
{ … }
unsigned int dmz_nr_unmap_seq_zones(struct dmz_metadata *zmd, int idx)
{ … }
static struct dm_zone *dmz_get(struct dmz_metadata *zmd, unsigned int zone_id)
{ … }
static struct dm_zone *dmz_insert(struct dmz_metadata *zmd,
unsigned int zone_id, struct dmz_dev *dev)
{ … }
const char *dmz_metadata_label(struct dmz_metadata *zmd)
{ … }
bool dmz_check_dev(struct dmz_metadata *zmd)
{ … }
bool dmz_dev_is_dying(struct dmz_metadata *zmd)
{ … }
void dmz_lock_map(struct dmz_metadata *zmd)
{ … }
void dmz_unlock_map(struct dmz_metadata *zmd)
{ … }
void dmz_lock_metadata(struct dmz_metadata *zmd)
{ … }
void dmz_unlock_metadata(struct dmz_metadata *zmd)
{ … }
void dmz_lock_flush(struct dmz_metadata *zmd)
{ … }
void dmz_unlock_flush(struct dmz_metadata *zmd)
{ … }
static struct dmz_mblock *dmz_alloc_mblock(struct dmz_metadata *zmd,
sector_t mblk_no)
{ … }
static void dmz_free_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk)
{ … }
static void dmz_insert_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk)
{ … }
static struct dmz_mblock *dmz_get_mblock_fast(struct dmz_metadata *zmd,
sector_t mblk_no)
{ … }
static void dmz_mblock_bio_end_io(struct bio *bio)
{ … }
static struct dmz_mblock *dmz_get_mblock_slow(struct dmz_metadata *zmd,
sector_t mblk_no)
{ … }
static unsigned long dmz_shrink_mblock_cache(struct dmz_metadata *zmd,
unsigned long limit)
{ … }
static unsigned long dmz_mblock_shrinker_count(struct shrinker *shrink,
struct shrink_control *sc)
{ … }
static unsigned long dmz_mblock_shrinker_scan(struct shrinker *shrink,
struct shrink_control *sc)
{ … }
static void dmz_release_mblock(struct dmz_metadata *zmd,
struct dmz_mblock *mblk)
{ … }
static struct dmz_mblock *dmz_get_mblock(struct dmz_metadata *zmd,
sector_t mblk_no)
{ … }
static void dmz_dirty_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk)
{ … }
static int dmz_write_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk,
unsigned int set)
{ … }
static int dmz_rdwr_block(struct dmz_dev *dev, enum req_op op,
sector_t block, struct page *page)
{ … }
static int dmz_write_sb(struct dmz_metadata *zmd, unsigned int set)
{ … }
static int dmz_write_dirty_mblocks(struct dmz_metadata *zmd,
struct list_head *write_list,
unsigned int set)
{ … }
static int dmz_log_dirty_mblocks(struct dmz_metadata *zmd,
struct list_head *write_list)
{ … }
int dmz_flush_metadata(struct dmz_metadata *zmd)
{ … }
static int dmz_check_sb(struct dmz_metadata *zmd, struct dmz_sb *dsb,
bool tertiary)
{ … }
static int dmz_read_sb(struct dmz_metadata *zmd, struct dmz_sb *sb, int set)
{ … }
static int dmz_lookup_secondary_sb(struct dmz_metadata *zmd)
{ … }
static int dmz_get_sb(struct dmz_metadata *zmd, struct dmz_sb *sb, int set)
{ … }
static int dmz_recover_mblocks(struct dmz_metadata *zmd, unsigned int dst_set)
{ … }
static int dmz_load_sb(struct dmz_metadata *zmd)
{ … }
static int dmz_init_zone(struct blk_zone *blkz, unsigned int num, void *data)
{ … }
static int dmz_emulate_zones(struct dmz_metadata *zmd, struct dmz_dev *dev)
{ … }
static void dmz_drop_zones(struct dmz_metadata *zmd)
{ … }
static int dmz_init_zones(struct dmz_metadata *zmd)
{ … }
static int dmz_update_zone_cb(struct blk_zone *blkz, unsigned int idx,
void *data)
{ … }
static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
static int dmz_handle_seq_write_err(struct dmz_metadata *zmd,
struct dm_zone *zone)
{ … }
static int dmz_reset_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
static void dmz_get_zone_weight(struct dmz_metadata *zmd, struct dm_zone *zone);
static int dmz_load_mapping(struct dmz_metadata *zmd)
{ … }
static void dmz_set_chunk_mapping(struct dmz_metadata *zmd, unsigned int chunk,
unsigned int dzone_id, unsigned int bzone_id)
{ … }
static void __dmz_lru_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
static void dmz_lru_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
static void dmz_wait_for_free_zones(struct dmz_metadata *zmd)
{ … }
int dmz_lock_zone_reclaim(struct dm_zone *zone)
{ … }
void dmz_unlock_zone_reclaim(struct dm_zone *zone)
{ … }
static void dmz_wait_for_reclaim(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
static struct dm_zone *dmz_get_rnd_zone_for_reclaim(struct dmz_metadata *zmd,
unsigned int idx, bool idle)
{ … }
static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd,
unsigned int idx)
{ … }
struct dm_zone *dmz_get_zone_for_reclaim(struct dmz_metadata *zmd,
unsigned int dev_idx, bool idle)
{ … }
struct dm_zone *dmz_get_chunk_mapping(struct dmz_metadata *zmd,
unsigned int chunk, enum req_op op)
{ … }
void dmz_put_chunk_mapping(struct dmz_metadata *zmd, struct dm_zone *dzone)
{ … }
struct dm_zone *dmz_get_chunk_buffer(struct dmz_metadata *zmd,
struct dm_zone *dzone)
{ … }
struct dm_zone *dmz_alloc_zone(struct dmz_metadata *zmd, unsigned int dev_idx,
unsigned long flags)
{ … }
void dmz_free_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
void dmz_map_zone(struct dmz_metadata *zmd, struct dm_zone *dzone,
unsigned int chunk)
{ … }
void dmz_unmap_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
static unsigned int dmz_set_bits(unsigned long *bitmap,
unsigned int bit, unsigned int nr_bits)
{ … }
static struct dmz_mblock *dmz_get_bitmap(struct dmz_metadata *zmd,
struct dm_zone *zone,
sector_t chunk_block)
{ … }
int dmz_copy_valid_blocks(struct dmz_metadata *zmd, struct dm_zone *from_zone,
struct dm_zone *to_zone)
{ … }
int dmz_merge_valid_blocks(struct dmz_metadata *zmd, struct dm_zone *from_zone,
struct dm_zone *to_zone, sector_t chunk_block)
{ … }
int dmz_validate_blocks(struct dmz_metadata *zmd, struct dm_zone *zone,
sector_t chunk_block, unsigned int nr_blocks)
{ … }
static int dmz_clear_bits(unsigned long *bitmap, int bit, int nr_bits)
{ … }
int dmz_invalidate_blocks(struct dmz_metadata *zmd, struct dm_zone *zone,
sector_t chunk_block, unsigned int nr_blocks)
{ … }
static int dmz_test_block(struct dmz_metadata *zmd, struct dm_zone *zone,
sector_t chunk_block)
{ … }
static int dmz_to_next_set_block(struct dmz_metadata *zmd, struct dm_zone *zone,
sector_t chunk_block, unsigned int nr_blocks,
int set)
{ … }
int dmz_block_valid(struct dmz_metadata *zmd, struct dm_zone *zone,
sector_t chunk_block)
{ … }
int dmz_first_valid_block(struct dmz_metadata *zmd, struct dm_zone *zone,
sector_t *chunk_block)
{ … }
static int dmz_count_bits(void *bitmap, int bit, int nr_bits)
{ … }
static void dmz_get_zone_weight(struct dmz_metadata *zmd, struct dm_zone *zone)
{ … }
static void dmz_cleanup_metadata(struct dmz_metadata *zmd)
{ … }
static void dmz_print_dev(struct dmz_metadata *zmd, int num)
{ … }
int dmz_ctr_metadata(struct dmz_dev *dev, int num_dev,
struct dmz_metadata **metadata,
const char *devname)
{ … }
void dmz_dtr_metadata(struct dmz_metadata *zmd)
{ … }
int dmz_resume_metadata(struct dmz_metadata *zmd)
{ … }