linux/drivers/block/null_blk/zoned.c

// SPDX-License-Identifier: GPL-2.0
#include <linux/vmalloc.h>
#include <linux/bitmap.h>
#include "null_blk.h"

#define CREATE_TRACE_POINTS
#include "trace.h"

#undef pr_fmt
#define pr_fmt(fmt)

#define NULL_ZONE_INVALID_WP

static inline sector_t mb_to_sects(unsigned long mb)
{}

static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect)
{}

static inline void null_init_zone_lock(struct nullb_device *dev,
				       struct nullb_zone *zone)
{}

static inline void null_lock_zone(struct nullb_device *dev,
				  struct nullb_zone *zone)
{}

static inline void null_unlock_zone(struct nullb_device *dev,
				    struct nullb_zone *zone)
{}

int null_init_zoned_dev(struct nullb_device *dev,
			struct queue_limits *lim)
{}

int null_register_zoned_dev(struct nullb *nullb)
{}

void null_free_zoned_dev(struct nullb_device *dev)
{}

int null_report_zones(struct gendisk *disk, sector_t sector,
		unsigned int nr_zones, report_zones_cb cb, void *data)
{}

/*
 * This is called in the case of memory backing from null_process_cmd()
 * with the target zone already locked.
 */
size_t null_zone_valid_read_len(struct nullb *nullb,
				sector_t sector, unsigned int len)
{}

static void null_close_imp_open_zone(struct nullb_device *dev)
{}

static blk_status_t null_check_active(struct nullb_device *dev)
{}

static blk_status_t null_check_open(struct nullb_device *dev)
{}

/*
 * This function matches the manage open zone resources function in the ZBC standard,
 * with the addition of max active zones support (added in the ZNS standard).
 *
 * The function determines if a zone can transition to implicit open or explicit open,
 * while maintaining the max open zone (and max active zone) limit(s). It may close an
 * implicit open zone in order to make additional zone resources available.
 *
 * ZBC states that an implicit open zone shall be closed only if there is not
 * room within the open limit. However, with the addition of an active limit,
 * it is not certain that closing an implicit open zone will allow a new zone
 * to be opened, since we might already be at the active limit capacity.
 */
static blk_status_t null_check_zone_resources(struct nullb_device *dev,
					      struct nullb_zone *zone)
{}

static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
				    unsigned int nr_sectors, bool append)
{}

static blk_status_t null_open_zone(struct nullb_device *dev,
				   struct nullb_zone *zone)
{}

static blk_status_t null_close_zone(struct nullb_device *dev,
				    struct nullb_zone *zone)
{}

static blk_status_t null_finish_zone(struct nullb_device *dev,
				     struct nullb_zone *zone)
{}

static blk_status_t null_reset_zone(struct nullb_device *dev,
				    struct nullb_zone *zone)
{}

static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_op op,
				   sector_t sector)
{}

blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_op op,
				    sector_t sector, sector_t nr_sectors)
{}

/*
 * Set a zone in the read-only or offline condition.
 */
static void null_set_zone_cond(struct nullb_device *dev,
			       struct nullb_zone *zone, enum blk_zone_cond cond)
{}

/*
 * Identify a zone from the sector written to configfs file. Then set zone
 * condition to the zone.
 */
ssize_t zone_cond_store(struct nullb_device *dev, const char *page,
			size_t count, enum blk_zone_cond cond)
{}