Block device abstraction layer. More...
Data Structures | |
struct | spdk_bdev_media_event |
Media management event details. More... | |
struct | spdk_bdev_enable_histogram_opts |
Structure with optional enable histogram parameters. More... | |
struct | spdk_bdev_io_stat |
struct | spdk_bdev_opts |
union | spdk_bdev_nvme_ctratt |
Union for controller attributes field, to list whether bdev supports fdp etc. More... | |
union | spdk_bdev_nvme_cdw12 |
Union for command dword 12, which by convention matches the NVMe command dword 12 definition. More... | |
union | spdk_bdev_nvme_cdw13 |
Union for command dword 13, which by convention matches the NVMe command dword 13 definition. More... | |
struct | spdk_bdev_ext_io_opts |
Structure with optional IO request parameters. More... | |
struct | spdk_bdev_open_opts |
Structure with optional synchronous bdev open parameters. More... | |
struct | spdk_bdev_open_async_opts |
Structure with optional asynchronous bdev open parameters. More... | |
struct | spdk_bdev_io_wait_entry |
Structure to register a callback when an spdk_bdev_io becomes available. More... | |
Typedefs | |
typedef void(* | spdk_bdev_remove_cb_t) (void *remove_ctx) |
Block device remove callback. | |
typedef void(* | spdk_bdev_event_cb_t) (enum spdk_bdev_event_type type, struct spdk_bdev *bdev, void *event_ctx) |
Block device event callback. | |
typedef void(* | spdk_bdev_io_completion_cb) (struct spdk_bdev_io *bdev_io, bool success, void *cb_arg) |
Block device completion callback. | |
typedef void(* | spdk_bdev_wait_for_examine_cb) (void *arg) |
typedef void(* | spdk_bdev_init_cb) (void *cb_arg, int rc) |
Block device initialization callback. | |
typedef void(* | spdk_bdev_fini_cb) (void *cb_arg) |
Block device finish callback. | |
typedef void(* | spdk_bdev_get_device_stat_cb) (struct spdk_bdev *bdev, struct spdk_bdev_io_stat *stat, void *cb_arg, int rc) |
typedef void(* | spdk_bdev_io_timeout_cb) (void *cb_arg, struct spdk_bdev_io *bdev_io) |
Block device channel IO timeout callback. | |
typedef void(* | spdk_bdev_open_async_cb_t) (struct spdk_bdev_desc *desc, int rc, void *cb_arg) |
Block device asynchronous open callback. | |
typedef int(* | spdk_for_each_bdev_fn) (void *ctx, struct spdk_bdev *bdev) |
Callback function for spdk_for_each_bdev() and spdk_for_each_bdev_leaf(). | |
typedef void(* | spdk_bdev_io_wait_cb) (void *cb_arg) |
Block device I/O wait callback. | |
typedef void(* | spdk_bdev_histogram_status_cb) (void *cb_arg, int status) |
typedef void(* | spdk_bdev_histogram_data_cb) (void *cb_arg, int status, struct spdk_histogram_data *histogram) |
typedef void(* | spdk_bdev_for_each_channel_msg) (struct spdk_bdev_channel_iter *i, struct spdk_bdev *bdev, struct spdk_io_channel *ch, void *ctx) |
Called on the appropriate thread for each channel associated with the given bdev. | |
typedef void(* | spdk_bdev_for_each_channel_done) (struct spdk_bdev *bdev, void *ctx, int status) |
spdk_bdev_for_each_channel() function's final callback with the given bdev. | |
Enumerations | |
enum | spdk_bdev_event_type { SPDK_BDEV_EVENT_REMOVE , SPDK_BDEV_EVENT_RESIZE , SPDK_BDEV_EVENT_MEDIA_MANAGEMENT } |
Asynchronous event type. | |
enum | spdk_bdev_status { SPDK_BDEV_STATUS_INVALID , SPDK_BDEV_STATUS_READY , SPDK_BDEV_STATUS_UNREGISTERING , SPDK_BDEV_STATUS_REMOVING } |
bdev status | |
enum | spdk_bdev_io_type { SPDK_BDEV_IO_TYPE_INVALID = 0 , SPDK_BDEV_IO_TYPE_READ , SPDK_BDEV_IO_TYPE_WRITE , SPDK_BDEV_IO_TYPE_UNMAP , SPDK_BDEV_IO_TYPE_FLUSH , SPDK_BDEV_IO_TYPE_RESET , SPDK_BDEV_IO_TYPE_NVME_ADMIN , SPDK_BDEV_IO_TYPE_NVME_IO , SPDK_BDEV_IO_TYPE_NVME_IO_MD , SPDK_BDEV_IO_TYPE_WRITE_ZEROES , SPDK_BDEV_IO_TYPE_ZCOPY , SPDK_BDEV_IO_TYPE_GET_ZONE_INFO , SPDK_BDEV_IO_TYPE_ZONE_MANAGEMENT , SPDK_BDEV_IO_TYPE_ZONE_APPEND , SPDK_BDEV_IO_TYPE_COMPARE , SPDK_BDEV_IO_TYPE_COMPARE_AND_WRITE , SPDK_BDEV_IO_TYPE_ABORT , SPDK_BDEV_IO_TYPE_SEEK_HOLE , SPDK_BDEV_IO_TYPE_SEEK_DATA , SPDK_BDEV_IO_TYPE_COPY , SPDK_BDEV_IO_TYPE_NVME_IOV_MD , SPDK_BDEV_NUM_IO_TYPES } |
bdev I/O type | |
enum | spdk_bdev_qos_rate_limit_type { SPDK_BDEV_QOS_RW_IOPS_RATE_LIMIT = 0 , SPDK_BDEV_QOS_RW_BPS_RATE_LIMIT , SPDK_BDEV_QOS_R_BPS_RATE_LIMIT , SPDK_BDEV_QOS_W_BPS_RATE_LIMIT , SPDK_BDEV_QOS_NUM_RATE_LIMIT_TYPES } |
bdev QoS rate limit type More... | |
enum | spdk_bdev_reset_stat_mode { SPDK_BDEV_RESET_STAT_ALL , SPDK_BDEV_RESET_STAT_MAXMIN , SPDK_BDEV_RESET_STAT_NONE } |
Functions | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_bdev_enable_histogram_opts)==9, "Incorrect size") | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_bdev_opts)==32, "Incorrect size") | |
SPDK_STATIC_ASSERT (sizeof(union spdk_bdev_nvme_ctratt)==4, "Incorrect size") | |
SPDK_STATIC_ASSERT (sizeof(union spdk_bdev_nvme_cdw12)==4, "Incorrect size") | |
SPDK_STATIC_ASSERT (sizeof(union spdk_bdev_nvme_cdw13)==4, "Incorrect size") | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_bdev_ext_io_opts)==52, "Incorrect size") | |
void | spdk_bdev_get_opts (struct spdk_bdev_opts *opts, size_t opts_size) |
Get the options for the bdev module. | |
int | spdk_bdev_set_opts (struct spdk_bdev_opts *opts) |
int | spdk_bdev_wait_for_examine (spdk_bdev_wait_for_examine_cb cb_fn, void *cb_arg) |
Report when all bdevs finished the examine process. | |
int | spdk_bdev_examine (const char *name) |
Examine a block device explicitly. | |
void | spdk_bdev_initialize (spdk_bdev_init_cb cb_fn, void *cb_arg) |
Initialize block device modules. | |
void | spdk_bdev_finish (spdk_bdev_fini_cb cb_fn, void *cb_arg) |
Perform cleanup work to remove the registered block device modules. | |
void | spdk_bdev_subsystem_config_json (struct spdk_json_write_ctx *w) |
Get the full configuration options for the registered block device modules and created bdevs. | |
const char * | spdk_bdev_get_module_name (const struct spdk_bdev *bdev) |
Get block device module name. | |
struct spdk_bdev * | spdk_bdev_get_by_name (const char *bdev_name) |
Get block device by the block device name. | |
struct spdk_bdev * | spdk_bdev_first (void) |
Get the first registered block device. | |
struct spdk_bdev * | spdk_bdev_next (struct spdk_bdev *prev) |
Get the next registered block device. | |
struct spdk_bdev * | spdk_bdev_first_leaf (void) |
Get the first block device without virtual block devices on top. | |
struct spdk_bdev * | spdk_bdev_next_leaf (struct spdk_bdev *prev) |
Get the next block device without virtual block devices on top. | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_bdev_open_opts)==16, "Incorrect size") | |
void | spdk_bdev_open_opts_init (struct spdk_bdev_open_opts *opts, size_t opts_size) |
Initialize bdev open options. | |
int | spdk_bdev_open_ext (const char *bdev_name, bool write, spdk_bdev_event_cb_t event_cb, void *event_ctx, struct spdk_bdev_desc **desc) |
Open a block device for I/O operations. | |
int | spdk_bdev_open_ext_v2 (const char *bdev_name, bool write, spdk_bdev_event_cb_t event_cb, void *event_ctx, struct spdk_bdev_open_opts *opts, struct spdk_bdev_desc **desc) |
Open a block device for I/O operations with options. | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_bdev_open_async_opts)==16, "Incorrect size") | |
int | spdk_bdev_open_async (const char *bdev_name, bool write, spdk_bdev_event_cb_t event_cb, void *event_ctx, struct spdk_bdev_open_async_opts *opts, spdk_bdev_open_async_cb_t open_cb, void *open_cb_arg) |
Open a block device for I/O operations asynchronously with options. | |
void | spdk_bdev_close (struct spdk_bdev_desc *desc) |
Close a previously opened block device. | |
int32_t | spdk_bdev_get_numa_id (struct spdk_bdev *bdev) |
Get the NUMA node ID for the specified bdev. | |
int | spdk_for_each_bdev (void *ctx, spdk_for_each_bdev_fn fn) |
Call the provided callback function for every registered block device. | |
int | spdk_for_each_bdev_leaf (void *ctx, spdk_for_each_bdev_fn fn) |
Call the provided callback function for every block device without virtual block devices on top. | |
struct spdk_bdev * | spdk_bdev_desc_get_bdev (struct spdk_bdev_desc *desc) |
Get the bdev associated with a bdev descriptor. | |
uint32_t | spdk_bdev_desc_get_block_size (struct spdk_bdev_desc *desc) |
Get logical block size, specific to a bdev descriptor. | |
uint32_t | spdk_bdev_desc_get_md_size (struct spdk_bdev_desc *desc) |
Get metadata size, specific to a bdev descriptor. | |
bool | spdk_bdev_desc_is_md_interleaved (struct spdk_bdev_desc *desc) |
Query whether metadata is interleaved with block data or separated with block data, specific to a bdev descriptor. | |
bool | spdk_bdev_desc_is_md_separate (struct spdk_bdev_desc *desc) |
Query whether metadata is interleaved with block data or separated from block data, specific to a bdev descriptor. | |
enum spdk_dif_type | spdk_bdev_desc_get_dif_type (struct spdk_bdev_desc *desc) |
Get DIF type, specific to a bdev descriptor. | |
enum spdk_dif_pi_format | spdk_bdev_desc_get_dif_pi_format (struct spdk_bdev_desc *desc) |
Get DIF protection information format of the block device, specific to a bdev descriptor. | |
bool | spdk_bdev_desc_is_dif_head_of_md (struct spdk_bdev_desc *desc) |
Check whether DIF is set in the first 8/16 bytes or the last 8/16 bytes of metadata, specific to a bdev descriptor. | |
bool | spdk_bdev_desc_is_dif_check_enabled (struct spdk_bdev_desc *desc, enum spdk_dif_check_type check_type) |
Check whether the DIF check type is enabled, specific to a bdev descriptor. | |
int | spdk_bdev_set_timeout (struct spdk_bdev_desc *desc, uint64_t timeout_in_sec, spdk_bdev_io_timeout_cb cb_fn, void *cb_arg) |
Set a time limit for the timeout IO of the bdev and timeout callback. | |
bool | spdk_bdev_io_type_supported (struct spdk_bdev *bdev, enum spdk_bdev_io_type io_type) |
Check whether the block device supports the I/O type. | |
const char * | spdk_bdev_get_io_type_name (enum spdk_bdev_io_type io_type) |
return the name of an IO type based on the io_type. | |
int | spdk_bdev_get_io_type (const char *io_type_string) |
Return the io_type based on the io_type_string. | |
int | spdk_bdev_dump_info_json (struct spdk_bdev *bdev, struct spdk_json_write_ctx *w) |
Output driver-specific information to a JSON stream. | |
const char * | spdk_bdev_get_name (const struct spdk_bdev *bdev) |
Get block device name. | |
const char * | spdk_bdev_get_product_name (const struct spdk_bdev *bdev) |
Get block device product name. | |
uint32_t | spdk_bdev_get_block_size (const struct spdk_bdev *bdev) |
Get block device logical block size. | |
uint32_t | spdk_bdev_get_write_unit_size (const struct spdk_bdev *bdev) |
Get the write unit size for this bdev. | |
uint64_t | spdk_bdev_get_num_blocks (const struct spdk_bdev *bdev) |
Get size of block device in logical blocks. | |
const char * | spdk_bdev_get_qos_rpc_type (enum spdk_bdev_qos_rate_limit_type type) |
Get the string of quality of service rate limit. | |
void | spdk_bdev_get_qos_rate_limits (struct spdk_bdev *bdev, uint64_t *limits) |
Get the quality of service rate limits on a bdev. | |
void | spdk_bdev_set_qos_rate_limits (struct spdk_bdev *bdev, uint64_t *limits, void(*cb_fn)(void *cb_arg, int status), void *cb_arg) |
Set the quality of service rate limits on a bdev. | |
size_t | spdk_bdev_get_buf_align (const struct spdk_bdev *bdev) |
Get minimum I/O buffer address alignment for a bdev. | |
uint32_t | spdk_bdev_get_optimal_io_boundary (const struct spdk_bdev *bdev) |
Get optimal I/O boundary for a bdev. | |
bool | spdk_bdev_has_write_cache (const struct spdk_bdev *bdev) |
Query whether block device has an enabled write cache. | |
const struct spdk_uuid * | spdk_bdev_get_uuid (const struct spdk_bdev *bdev) |
Get a bdev's UUID. | |
uint16_t | spdk_bdev_get_acwu (const struct spdk_bdev *bdev) |
Get block device atomic compare and write unit. | |
uint32_t | spdk_bdev_get_md_size (const struct spdk_bdev *bdev) |
Get block device metadata size. | |
bool | spdk_bdev_is_md_interleaved (const struct spdk_bdev *bdev) |
Query whether metadata is interleaved with block data or separated with block data. | |
bool | spdk_bdev_is_md_separate (const struct spdk_bdev *bdev) |
Query whether metadata is interleaved with block data or separated from block data. | |
bool | spdk_bdev_is_zoned (const struct spdk_bdev *bdev) |
Checks if bdev supports zoned namespace semantics. | |
uint32_t | spdk_bdev_get_data_block_size (const struct spdk_bdev *bdev) |
Get block device data block size. | |
uint32_t | spdk_bdev_get_physical_block_size (const struct spdk_bdev *bdev) |
Get block device physical block size. | |
enum spdk_dif_type | spdk_bdev_get_dif_type (const struct spdk_bdev *bdev) |
Get DIF type of the block device. | |
enum spdk_dif_pi_format | spdk_bdev_get_dif_pi_format (const struct spdk_bdev *bdev) |
Get DIF protection information format of the block device. | |
bool | spdk_bdev_is_dif_head_of_md (const struct spdk_bdev *bdev) |
Check whether DIF is set in the first 8/16 bytes or the last 8/16 bytes of metadata. | |
bool | spdk_bdev_is_dif_check_enabled (const struct spdk_bdev *bdev, enum spdk_dif_check_type check_type) |
Check whether the DIF check type is enabled. | |
uint32_t | spdk_bdev_get_max_copy (const struct spdk_bdev *bdev) |
Get block device max copy size. | |
uint64_t | spdk_bdev_get_qd (const struct spdk_bdev *bdev) |
Get the most recently measured queue depth from a bdev. | |
uint64_t | spdk_bdev_get_qd_sampling_period (const struct spdk_bdev *bdev) |
Get the queue depth polling period. | |
void | spdk_bdev_set_qd_sampling_period (struct spdk_bdev *bdev, uint64_t period) |
Enable or disable queue depth sampling for this bdev. | |
uint64_t | spdk_bdev_get_io_time (const struct spdk_bdev *bdev) |
Get the time spent processing IO for this device. | |
uint64_t | spdk_bdev_get_weighted_io_time (const struct spdk_bdev *bdev) |
Get the weighted IO processing time for this bdev. | |
struct spdk_io_channel * | spdk_bdev_get_io_channel (struct spdk_bdev_desc *desc) |
Obtain an I/O channel for the block device opened by the specified descriptor. | |
void * | spdk_bdev_get_module_ctx (struct spdk_bdev_desc *desc) |
Obtain a bdev module context for the block device opened by the specified descriptor. | |
int | spdk_bdev_seek_data (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t offset_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a data seek request to the bdev on the given channel. | |
int | spdk_bdev_seek_hole (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t offset_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a hole seek request to the bdev on the given channel. | |
int | spdk_bdev_read (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf, uint64_t offset, uint64_t nbytes, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a read request to the bdev on the given channel. | |
int | spdk_bdev_read_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a read request to the bdev on the given channel. | |
int | spdk_bdev_read_blocks_with_md (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf, void *md, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a read request to the bdev on the given channel. | |
int | spdk_bdev_readv (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, uint64_t offset, uint64_t nbytes, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a read request to the bdev on the given channel. | |
int | spdk_bdev_readv_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a read request to the bdev on the given channel. | |
int | spdk_bdev_readv_blocks_with_md (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, void *md, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a read request to the bdev on the given channel. | |
int | spdk_bdev_readv_blocks_ext (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg, struct spdk_bdev_ext_io_opts *opts) |
Submit a read request to the bdev on the given channel. | |
int | spdk_bdev_write (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf, uint64_t offset, uint64_t nbytes, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a write request to the bdev on the given channel. | |
int | spdk_bdev_write_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a write request to the bdev on the given channel. | |
int | spdk_bdev_write_blocks_with_md (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf, void *md, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a write request to the bdev on the given channel. | |
int | spdk_bdev_writev (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, uint64_t offset, uint64_t len, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a write request to the bdev on the given channel. | |
int | spdk_bdev_writev_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a write request to the bdev on the given channel. | |
int | spdk_bdev_writev_blocks_with_md (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, void *md, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a write request to the bdev on the given channel. | |
int | spdk_bdev_writev_blocks_ext (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg, struct spdk_bdev_ext_io_opts *opts) |
Submit a write request to the bdev on the given channel. | |
int | spdk_bdev_compare_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a compare request to the bdev on the given channel. | |
int | spdk_bdev_compare_blocks_with_md (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *buf, void *md, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a compare request to the bdev on the given channel. | |
int | spdk_bdev_comparev_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a compare request to the bdev on the given channel. | |
int | spdk_bdev_comparev_blocks_with_md (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, void *md, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a compare request to the bdev on the given channel. | |
int | spdk_bdev_comparev_and_writev_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *compare_iov, int compare_iovcnt, struct iovec *write_iov, int write_iovcnt, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit an atomic compare-and-write request to the bdev on the given channel. | |
int | spdk_bdev_zcopy_start (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, struct iovec *iov, int iovcnt, uint64_t offset_blocks, uint64_t num_blocks, bool populate, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a request to acquire a data buffer that represents the given range of blocks. | |
int | spdk_bdev_zcopy_end (struct spdk_bdev_io *bdev_io, bool commit, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a request to release a data buffer representing a range of blocks. | |
int | spdk_bdev_write_zeroes (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t offset, uint64_t len, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a write zeroes request to the bdev on the given channel. | |
int | spdk_bdev_write_zeroes_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a write zeroes request to the bdev on the given channel. | |
int | spdk_bdev_unmap (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t offset, uint64_t nbytes, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit an unmap request to the block device. | |
int | spdk_bdev_unmap_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit an unmap request to the block device. | |
int | spdk_bdev_flush (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t offset, uint64_t length, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a flush request to the bdev on the given channel. | |
int | spdk_bdev_flush_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a flush request to the bdev on the given channel. | |
int | spdk_bdev_reset (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a reset request to the bdev on the given channel. | |
int | spdk_bdev_abort (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, void *bio_cb_arg, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit abort requests to abort all I/Os which has bio_cb_arg as its callback context to the bdev on the given channel. | |
int | spdk_bdev_nvme_admin_passthru (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, const struct spdk_nvme_cmd *cmd, void *buf, size_t nbytes, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit an NVMe Admin command to the bdev. | |
int | spdk_bdev_nvme_io_passthru (struct spdk_bdev_desc *bdev_desc, struct spdk_io_channel *ch, const struct spdk_nvme_cmd *cmd, void *buf, size_t nbytes, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit an NVMe I/O command to the bdev. | |
int | spdk_bdev_nvme_io_passthru_md (struct spdk_bdev_desc *bdev_desc, struct spdk_io_channel *ch, const struct spdk_nvme_cmd *cmd, void *buf, size_t nbytes, void *md_buf, size_t md_len, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit an NVMe I/O command to the bdev. | |
int | spdk_bdev_nvme_iov_passthru_md (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, const struct spdk_nvme_cmd *cmd, struct iovec *iov, int iovcnt, size_t nbytes, void *md_buf, size_t md_len, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit an NVMe I/O command to the bdev. | |
int | spdk_bdev_copy_blocks (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, uint64_t dst_offset_blocks, uint64_t src_offset_blocks, uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg) |
Submit a copy request to the block device. | |
void | spdk_bdev_free_io (struct spdk_bdev_io *bdev_io) |
Free an I/O request. | |
int | spdk_bdev_queue_io_wait (struct spdk_bdev *bdev, struct spdk_io_channel *ch, struct spdk_bdev_io_wait_entry *entry) |
Add an entry into the calling thread's queue to be notified when an spdk_bdev_io becomes available. | |
void | spdk_bdev_get_io_stat (struct spdk_bdev *bdev, struct spdk_io_channel *ch, struct spdk_bdev_io_stat *stat, enum spdk_bdev_reset_stat_mode reset_mode) |
Return I/O statistics for this channel. | |
void | spdk_bdev_get_device_stat (struct spdk_bdev *bdev, struct spdk_bdev_io_stat *stat, enum spdk_bdev_reset_stat_mode reset_mode, spdk_bdev_get_device_stat_cb cb, void *cb_arg) |
Return I/O statistics for this bdev. | |
void | spdk_bdev_io_get_nvme_status (const struct spdk_bdev_io *bdev_io, uint32_t *cdw0, int *sct, int *sc) |
Get the status of bdev_io as an NVMe status code and command specific completion queue value. | |
void | spdk_bdev_io_get_nvme_fused_status (const struct spdk_bdev_io *bdev_io, uint32_t *cdw0, int *first_sct, int *first_sc, int *second_sct, int *second_sc) |
Get the status of bdev_io as an NVMe status codes and command specific completion queue value for fused operations such as compare-and-write. | |
void | spdk_bdev_io_get_scsi_status (const struct spdk_bdev_io *bdev_io, int *sc, int *sk, int *asc, int *ascq) |
Get the status of bdev_io as a SCSI status code. | |
void | spdk_bdev_io_get_aio_status (const struct spdk_bdev_io *bdev_io, int *aio_result) |
Get the status of bdev_io as aio errno. | |
void | spdk_bdev_io_get_iovec (struct spdk_bdev_io *bdev_io, struct iovec **iovp, int *iovcntp) |
Get the iovec describing the data buffer of a bdev_io. | |
void * | spdk_bdev_io_get_md_buf (struct spdk_bdev_io *bdev_io) |
Get metadata buffer. | |
void * | spdk_bdev_io_get_cb_arg (struct spdk_bdev_io *bdev_io) |
Get the callback argument of bdev_io to abort it by spdk_bdev_abort. | |
uint64_t | spdk_bdev_io_get_seek_offset (const struct spdk_bdev_io *bdev_io) |
Get the result of a previous seek function. | |
void | spdk_bdev_histogram_enable (struct spdk_bdev *bdev, spdk_bdev_histogram_status_cb cb_fn, void *cb_arg, bool enable) |
Enable or disable collecting histogram data on a bdev. | |
void | spdk_bdev_histogram_enable_ext (struct spdk_bdev *bdev, spdk_bdev_histogram_status_cb cb_fn, void *cb_arg, bool enable, struct spdk_bdev_enable_histogram_opts *opts) |
Enable or disable collecting histogram data on a bdev. | |
void | spdk_bdev_enable_histogram_opts_init (struct spdk_bdev_enable_histogram_opts *opts, size_t size) |
Initialize bdev enable histogram options structure. | |
void | spdk_bdev_histogram_get (struct spdk_bdev *bdev, struct spdk_histogram_data *histogram, spdk_bdev_histogram_data_cb cb_fn, void *cb_arg) |
Get aggregated histogram data from a bdev. | |
void | spdk_bdev_channel_get_histogram (struct spdk_io_channel *ch, spdk_bdev_histogram_data_cb cb_fn, void *cb_arg) |
Get histogram data of the specified channel for a bdev. | |
size_t | spdk_bdev_get_media_events (struct spdk_bdev_desc *bdev_desc, struct spdk_bdev_media_event *events, size_t max_events) |
Retrieves media events. | |
int | spdk_bdev_get_memory_domains (struct spdk_bdev *bdev, struct spdk_memory_domain **domains, int array_size) |
Get SPDK memory domains used by the given bdev. | |
void | spdk_bdev_for_each_channel_continue (struct spdk_bdev_channel_iter *i, int status) |
Helper function to iterate the next channel for spdk_bdev_for_each_channel(). | |
void | spdk_bdev_for_each_channel (struct spdk_bdev *bdev, spdk_bdev_for_each_channel_msg fn, void *ctx, spdk_bdev_for_each_channel_done cpl) |
Call 'fn' on each channel associated with the given bdev. | |
union spdk_bdev_nvme_ctratt | spdk_bdev_get_nvme_ctratt (struct spdk_bdev *bdev) |
Get controller attributes for the bdev. | |
uint32_t | spdk_bdev_get_nvme_nsid (struct spdk_bdev *bdev) |
Get NVMe namespace ID for a given bdev (only for NVMe bdevs). | |
Block device abstraction layer.
typedef void(* spdk_bdev_event_cb_t) (enum spdk_bdev_event_type type, struct spdk_bdev *bdev, void *event_ctx) |
Block device event callback.
type | Event type. |
bdev | Block device that triggered event. |
event_ctx | Context for the block device event. |
typedef void(* spdk_bdev_fini_cb) (void *cb_arg) |
Block device finish callback.
cb_arg | Callback argument. |
typedef void(* spdk_bdev_for_each_channel_done) (struct spdk_bdev *bdev, void *ctx, int status) |
spdk_bdev_for_each_channel() function's final callback with the given bdev.
bdev | Block device. |
ctx | context of the bdev channel iterator. |
status | 0 if it completed successfully, or negative errno if it failed. |
typedef void(* spdk_bdev_for_each_channel_msg) (struct spdk_bdev_channel_iter *i, struct spdk_bdev *bdev, struct spdk_io_channel *ch, void *ctx) |
Called on the appropriate thread for each channel associated with the given bdev.
i | bdev channel iterator. |
bdev | Block device. |
ch | I/O channel. |
ctx | context of the bdev channel iterator. |
typedef void(* spdk_bdev_init_cb) (void *cb_arg, int rc) |
Block device initialization callback.
cb_arg | Callback argument. |
rc | 0 if block device initialized successfully or negative errno if it failed. |
typedef void(* spdk_bdev_io_completion_cb) (struct spdk_bdev_io *bdev_io, bool success, void *cb_arg) |
Block device completion callback.
bdev_io | Block device I/O that has completed. |
success | True if I/O completed successfully or false if it failed; additional error information may be retrieved from bdev_io by calling spdk_bdev_io_get_nvme_status() or spdk_bdev_io_get_scsi_status(). |
cb_arg | Callback argument specified when bdev_io was submitted. |
typedef void(* spdk_bdev_io_timeout_cb) (void *cb_arg, struct spdk_bdev_io *bdev_io) |
Block device channel IO timeout callback.
cb_arg | Callback argument |
bdev_io | The IO cause the timeout |
typedef void(* spdk_bdev_io_wait_cb) (void *cb_arg) |
Block device I/O wait callback.
Callback function to notify when an spdk_bdev_io structure is available to satisfy a call to one of the bdev I/O Submit Functions.
typedef void(* spdk_bdev_open_async_cb_t) (struct spdk_bdev_desc *desc, int rc, void *cb_arg) |
Block device asynchronous open callback.
desc | Output parameter for the descriptor when operation is successful. |
rc | 0 if block device is opened successfully or negated errno if failed. |
cb_arg | Callback argument. |
typedef void(* spdk_bdev_remove_cb_t) (void *remove_ctx) |
Block device remove callback.
remove_ctx | Context for the removed block device. |
typedef int(* spdk_for_each_bdev_fn) (void *ctx, struct spdk_bdev *bdev) |
Callback function for spdk_for_each_bdev() and spdk_for_each_bdev_leaf().
ctx | Context passed to the callback. |
bdev | Block device the callback handles. |
bdev QoS rate limit type
void spdk_bdev_channel_get_histogram | ( | struct spdk_io_channel * | ch, |
spdk_bdev_histogram_data_cb | cb_fn, | ||
void * | cb_arg ) |
Get histogram data of the specified channel for a bdev.
The histogram passed to cb_fn is only valid during the execution of cb_fn. Referencing the histogram after cb_fn returns is not supported and yields undetermined behavior.
ch | IO channel of bdev. |
cb_fn | Callback function to process the histogram of the channel. |
cb_arg | Argument to pass to cb_fn. |
void spdk_bdev_close | ( | struct spdk_bdev_desc * | desc | ) |
Close a previously opened block device.
Must be called on the same thread that the spdk_bdev_open_ext() was performed on.
desc | Block device descriptor to close. |
struct spdk_bdev * spdk_bdev_desc_get_bdev | ( | struct spdk_bdev_desc * | desc | ) |
Get the bdev associated with a bdev descriptor.
desc | Open block device descriptor |
uint32_t spdk_bdev_desc_get_block_size | ( | struct spdk_bdev_desc * | desc | ) |
Get logical block size, specific to a bdev descriptor.
desc | Open block device descriptor. |
enum spdk_dif_pi_format spdk_bdev_desc_get_dif_pi_format | ( | struct spdk_bdev_desc * | desc | ) |
Get DIF protection information format of the block device, specific to a bdev descriptor.
Note that this function is valid only if DIF type is not SPDK_DIF_DISABLE.
desc | Open block device descriptor. |
enum spdk_dif_type spdk_bdev_desc_get_dif_type | ( | struct spdk_bdev_desc * | desc | ) |
Get DIF type, specific to a bdev descriptor.
desc | Open block device descriptor. |
uint32_t spdk_bdev_desc_get_md_size | ( | struct spdk_bdev_desc * | desc | ) |
Get metadata size, specific to a bdev descriptor.
desc | Open block device descriptor |
bool spdk_bdev_desc_is_dif_check_enabled | ( | struct spdk_bdev_desc * | desc, |
enum spdk_dif_check_type | check_type ) |
Check whether the DIF check type is enabled, specific to a bdev descriptor.
desc | Open block device descriptor. |
check_type | The specific DIF check type. |
bool spdk_bdev_desc_is_dif_head_of_md | ( | struct spdk_bdev_desc * | desc | ) |
Check whether DIF is set in the first 8/16 bytes or the last 8/16 bytes of metadata, specific to a bdev descriptor.
Note that this function is valid only if DIF type is not SPDK_DIF_DISABLE.
desc | Open block device descriptor.. |
bool spdk_bdev_desc_is_md_interleaved | ( | struct spdk_bdev_desc * | desc | ) |
Query whether metadata is interleaved with block data or separated with block data, specific to a bdev descriptor.
Note this function is valid only if there is metadata.
desc | Open block device descriptor. |
bool spdk_bdev_desc_is_md_separate | ( | struct spdk_bdev_desc * | desc | ) |
Query whether metadata is interleaved with block data or separated from block data, specific to a bdev descriptor.
Note this function is valid only if there is metadata.
desc | Open block device descriptor. |
int spdk_bdev_dump_info_json | ( | struct spdk_bdev * | bdev, |
struct spdk_json_write_ctx * | w ) |
Output driver-specific information to a JSON stream.
The JSON write context will be initialized with an open object, so the bdev driver should write a name(based on the driver name) followed by a JSON value (most likely another nested object).
bdev | Block device to query. |
w | JSON write context. It will store the driver-specific configuration context. |
void spdk_bdev_enable_histogram_opts_init | ( | struct spdk_bdev_enable_histogram_opts * | opts, |
size_t | size ) |
Initialize bdev enable histogram options structure.
opts | The structure to initialize. |
size | The size of *opts. |
int spdk_bdev_examine | ( | const char * | name | ) |
Examine a block device explicitly.
This function must be called from the SPDK app thread.
name | the name or alias of the block device |
void spdk_bdev_finish | ( | spdk_bdev_fini_cb | cb_fn, |
void * | cb_arg ) |
Perform cleanup work to remove the registered block device modules.
cb_fn | Called when the removal is complete. |
cb_arg | Argument passed to function cb_fn. |
struct spdk_bdev * spdk_bdev_first | ( | void | ) |
Get the first registered block device.
struct spdk_bdev * spdk_bdev_first_leaf | ( | void | ) |
Get the first block device without virtual block devices on top.
This function only traverses over block devices which have no virtual block devices on top of them, then get the first one.
void spdk_bdev_for_each_channel | ( | struct spdk_bdev * | bdev, |
spdk_bdev_for_each_channel_msg | fn, | ||
void * | ctx, | ||
spdk_bdev_for_each_channel_done | cpl ) |
Call 'fn' on each channel associated with the given bdev.
This happens asynchronously, so fn may be called after spdk_bdev_for_each_channel returns. 'fn' will be called for each channel serially, such that two calls to 'fn' will not overlap in time. After 'fn' has been called, call spdk_bdev_for_each_channel_continue() to continue iterating. Note that the spdk_bdev_for_each_channel_continue() function can be called asynchronously.
bdev | 'fn' will be called on each channel associated with this given bdev. |
fn | Called on the appropriate thread for each channel associated with the given bdev. |
ctx | Context for the caller. |
cpl | Called on the thread that spdk_bdev_for_each_channel was initially called from when 'fn' has been called on each channel. |
void spdk_bdev_for_each_channel_continue | ( | struct spdk_bdev_channel_iter * | i, |
int | status ) |
Helper function to iterate the next channel for spdk_bdev_for_each_channel().
i | bdev channel iterator. |
status | Status for the bdev channel iterator; for non 0 status remaining iterations are terminated. |
void spdk_bdev_free_io | ( | struct spdk_bdev_io * | bdev_io | ) |
Free an I/O request.
This should only be called after the completion callback for the I/O has been called and notifies the bdev layer that memory may now be released.
bdev_io | I/O request. |
uint16_t spdk_bdev_get_acwu | ( | const struct spdk_bdev * | bdev | ) |
Get block device atomic compare and write unit.
bdev | Block device to query. |
uint32_t spdk_bdev_get_block_size | ( | const struct spdk_bdev * | bdev | ) |
Get block device logical block size.
bdev | Block device to query. |
size_t spdk_bdev_get_buf_align | ( | const struct spdk_bdev * | bdev | ) |
Get minimum I/O buffer address alignment for a bdev.
bdev | Block device to query. |
struct spdk_bdev * spdk_bdev_get_by_name | ( | const char * | bdev_name | ) |
Get block device by the block device name.
bdev_name | The name of the block device. |
uint32_t spdk_bdev_get_data_block_size | ( | const struct spdk_bdev * | bdev | ) |
Get block device data block size.
Data block size is equal to block size if there is no metadata or metadata is separated with block data, or equal to block size minus metadata size if there is metadata and it is interleaved with block data.
bdev | Block device to query. |
void spdk_bdev_get_device_stat | ( | struct spdk_bdev * | bdev, |
struct spdk_bdev_io_stat * | stat, | ||
enum spdk_bdev_reset_stat_mode | reset_mode, | ||
spdk_bdev_get_device_stat_cb | cb, | ||
void * | cb_arg ) |
Return I/O statistics for this bdev.
All the required information will be passed via the callback function.
bdev | Block device to query. |
stat | Structure for aggregating collected statistics. Passed as argument to cb. |
reset_mode | Mode to determine how I/O stat should be reset after obtaining it. |
cb | Called when this operation completes. |
cb_arg | Argument passed to callback function. |
enum spdk_dif_pi_format spdk_bdev_get_dif_pi_format | ( | const struct spdk_bdev * | bdev | ) |
Get DIF protection information format of the block device.
Note that this function is valid only if DIF type is not SPDK_DIF_DISABLE.
bdev | Block device to query. |
enum spdk_dif_type spdk_bdev_get_dif_type | ( | const struct spdk_bdev * | bdev | ) |
Get DIF type of the block device.
bdev | Block device to query. |
struct spdk_io_channel * spdk_bdev_get_io_channel | ( | struct spdk_bdev_desc * | desc | ) |
Obtain an I/O channel for the block device opened by the specified descriptor.
I/O channels are bound to threads, so the resulting I/O channel may only be used from the thread it was originally obtained from.
desc | Block device descriptor. |
void spdk_bdev_get_io_stat | ( | struct spdk_bdev * | bdev, |
struct spdk_io_channel * | ch, | ||
struct spdk_bdev_io_stat * | stat, | ||
enum spdk_bdev_reset_stat_mode | reset_mode ) |
Return I/O statistics for this channel.
bdev | Block device. |
ch | I/O channel. Obtained by calling spdk_bdev_get_io_channel(). |
stat | The per-channel statistics. |
reset_mode | Mode to determine how I/O stat should be reset after obtaining it. |
uint64_t spdk_bdev_get_io_time | ( | const struct spdk_bdev * | bdev | ) |
Get the time spent processing IO for this device.
This value is dependent upon the queue depth sampling period and is incremented at sampling time by the sampling period only if the measured queue depth is greater than 0.
The disk utilization can be calculated by the following formula: disk_util = (io_time_2 - io_time_1) / elapsed_time. The user is responsible for tracking the elapsed time between two measurements.
bdev | Block device to query. |
int spdk_bdev_get_io_type | ( | const char * | io_type_string | ) |
Return the io_type based on the io_type_string.
io_type_string | Name of the IO type as a null-terminated string. |
const char * spdk_bdev_get_io_type_name | ( | enum spdk_bdev_io_type | io_type | ) |
return the name of an IO type based on the io_type.
io_type | The specific I/O type like read, write, flush, unmap. |
uint32_t spdk_bdev_get_max_copy | ( | const struct spdk_bdev * | bdev | ) |
Get block device max copy size.
bdev | Block device to query. |
uint32_t spdk_bdev_get_md_size | ( | const struct spdk_bdev * | bdev | ) |
Get block device metadata size.
bdev | Block device to query. |
size_t spdk_bdev_get_media_events | ( | struct spdk_bdev_desc * | bdev_desc, |
struct spdk_bdev_media_event * | events, | ||
size_t | max_events ) |
Retrieves media events.
Can only be called from the context of SPDK_BDEV_EVENT_MEDIA_MANAGEMENT event callback. These events are sent by devices exposing raw access to the physical medium (e.g. Open Channel SSD).
bdev_desc | Block device descriptor |
events | Array of media management event descriptors |
max_events | Size of the events array |
int spdk_bdev_get_memory_domains | ( | struct spdk_bdev * | bdev, |
struct spdk_memory_domain ** | domains, | ||
int | array_size ) |
Get SPDK memory domains used by the given bdev.
If bdev reports that it uses memory domains that means that it can work with data buffers located in those memory domains.
The user can call this function with domains set to NULL and array_size set to 0 to get the number of memory domains used by bdev
bdev | Block device |
domains | Pointer to an array of memory domains to be filled by this function. The user should allocate big enough array to keep all memory domains used by bdev and all underlying bdevs |
array_size | size of domains array |
void * spdk_bdev_get_module_ctx | ( | struct spdk_bdev_desc * | desc | ) |
Obtain a bdev module context for the block device opened by the specified descriptor.
desc | Block device descriptor. |
const char * spdk_bdev_get_module_name | ( | const struct spdk_bdev * | bdev | ) |
Get block device module name.
bdev | Block device to query. |
const char * spdk_bdev_get_name | ( | const struct spdk_bdev * | bdev | ) |
Get block device name.
bdev | Block device to query. |
uint64_t spdk_bdev_get_num_blocks | ( | const struct spdk_bdev * | bdev | ) |
Get size of block device in logical blocks.
bdev | Block device to query. |
Logical blocks are numbered from 0 to spdk_bdev_get_num_blocks(bdev) - 1, inclusive.
int32_t spdk_bdev_get_numa_id | ( | struct spdk_bdev * | bdev | ) |
Get the NUMA node ID for the specified bdev.
bdev | Block device to get the NUMA node ID for |
union spdk_bdev_nvme_ctratt spdk_bdev_get_nvme_ctratt | ( | struct spdk_bdev * | bdev | ) |
Get controller attributes for the bdev.
bdev | Block device to query. |
uint32_t spdk_bdev_get_nvme_nsid | ( | struct spdk_bdev * | bdev | ) |
Get NVMe namespace ID for a given bdev (only for NVMe bdevs).
bdev | Block device to query. |
uint32_t spdk_bdev_get_optimal_io_boundary | ( | const struct spdk_bdev * | bdev | ) |
Get optimal I/O boundary for a bdev.
bdev | Block device to query. |
void spdk_bdev_get_opts | ( | struct spdk_bdev_opts * | opts, |
size_t | opts_size ) |
Get the options for the bdev module.
opts | Output parameter for options. |
opts_size | sizeof(*opts) |
uint32_t spdk_bdev_get_physical_block_size | ( | const struct spdk_bdev * | bdev | ) |
Get block device physical block size.
bdev | Block device to query. |
const char * spdk_bdev_get_product_name | ( | const struct spdk_bdev * | bdev | ) |
Get block device product name.
bdev | Block device to query. |
uint64_t spdk_bdev_get_qd | ( | const struct spdk_bdev * | bdev | ) |
Get the most recently measured queue depth from a bdev.
The reported queue depth is the aggregate of outstanding I/O across all open channels associated with this bdev.
bdev | Block device to query. |
uint64_t spdk_bdev_get_qd_sampling_period | ( | const struct spdk_bdev * | bdev | ) |
Get the queue depth polling period.
The return value of this function is only valid if the bdev's queue depth tracking status is set to true.
bdev | Block device to query. |
void spdk_bdev_get_qos_rate_limits | ( | struct spdk_bdev * | bdev, |
uint64_t * | limits ) |
Get the quality of service rate limits on a bdev.
bdev | Block device to query. |
limits | Pointer to the QoS rate limits array which holding the limits. |
The limits are ordered based on the spdk_bdev_qos_rate_limit_type enum.
const char * spdk_bdev_get_qos_rpc_type | ( | enum spdk_bdev_qos_rate_limit_type | type | ) |
Get the string of quality of service rate limit.
type | Type of rate limit to query. |
Get a bdev's UUID.
bdev | Block device to query. |
All bdevs will have a UUID, but not all UUIDs will be persistent across application runs.
uint64_t spdk_bdev_get_weighted_io_time | ( | const struct spdk_bdev * | bdev | ) |
Get the weighted IO processing time for this bdev.
This value is dependent upon the queue depth sampling period and is equal to the time spent reading from or writing to a device times the measured queue depth during each sampling period.
The average queue depth can be calculated by the following formula: queue_depth = (weighted_io_time_2 - weighted_io_time_1) / elapsed_time. The user is responsible for tracking the elapsed time between two measurements.
bdev | Block device to query. |
uint32_t spdk_bdev_get_write_unit_size | ( | const struct spdk_bdev * | bdev | ) |
Get the write unit size for this bdev.
Write unit size is required number of logical blocks to perform write operation on block device.
Unit of write unit size is logical block and the minimum of write unit size is one. Write operations must be multiple of write unit size.
bdev | Block device to query. |
bool spdk_bdev_has_write_cache | ( | const struct spdk_bdev * | bdev | ) |
Query whether block device has an enabled write cache.
bdev | Block device to query. |
If this function returns true, written data may not be persistent until a flush command is issued.
void spdk_bdev_histogram_enable | ( | struct spdk_bdev * | bdev, |
spdk_bdev_histogram_status_cb | cb_fn, | ||
void * | cb_arg, | ||
bool | enable ) |
Enable or disable collecting histogram data on a bdev.
bdev | Block device. |
cb_fn | Callback function to be called when histograms are enabled. |
cb_arg | Argument to pass to cb_fn. |
enable | Enable/disable flag |
void spdk_bdev_histogram_enable_ext | ( | struct spdk_bdev * | bdev, |
spdk_bdev_histogram_status_cb | cb_fn, | ||
void * | cb_arg, | ||
bool | enable, | ||
struct spdk_bdev_enable_histogram_opts * | opts ) |
Enable or disable collecting histogram data on a bdev.
This differs from spdk_bdev_histogram_enable by allowing Optional structure with extended enable histogram options.
bdev | Block device. |
cb_fn | Callback function to be called when histograms are enabled. |
cb_arg | Argument to pass to cb_fn. |
enable | Enable/disable flag |
opts | Optional structure with extended enable histogram options. size member of this structure is used for ABI compatibility and must be set to sizeof(struct spdk_bdev_enable_histogram_opts). |
void spdk_bdev_histogram_get | ( | struct spdk_bdev * | bdev, |
struct spdk_histogram_data * | histogram, | ||
spdk_bdev_histogram_data_cb | cb_fn, | ||
void * | cb_arg ) |
Get aggregated histogram data from a bdev.
Callback provides merged histogram for specified bdev.
bdev | Block device. |
histogram | Histogram for aggregated data |
cb_fn | Callback function to be called with data collected on bdev. |
cb_arg | Argument to pass to cb_fn. |
void spdk_bdev_initialize | ( | spdk_bdev_init_cb | cb_fn, |
void * | cb_arg ) |
Initialize block device modules.
cb_fn | Called when the initialization is complete. |
cb_arg | Argument passed to function cb_fn. |
void spdk_bdev_io_get_aio_status | ( | const struct spdk_bdev_io * | bdev_io, |
int * | aio_result ) |
Get the status of bdev_io as aio errno.
bdev_io | I/O to get the status from. |
aio_result | Negative errno returned from AIO. |
void * spdk_bdev_io_get_cb_arg | ( | struct spdk_bdev_io * | bdev_io | ) |
Get the callback argument of bdev_io to abort it by spdk_bdev_abort.
bdev_io | I/O to get the callback argument from. |
void spdk_bdev_io_get_iovec | ( | struct spdk_bdev_io * | bdev_io, |
struct iovec ** | iovp, | ||
int * | iovcntp ) |
Get the iovec describing the data buffer of a bdev_io.
bdev_io | I/O to describe with iovec. |
iovp | Pointer to be filled with iovec. |
iovcntp | Pointer to be filled with number of iovec entries. |
void * spdk_bdev_io_get_md_buf | ( | struct spdk_bdev_io * | bdev_io | ) |
Get metadata buffer.
Only makes sense if the IO uses separate buffer for metadata transfer.
bdev_io | I/O to retrieve the buffer from. |
void spdk_bdev_io_get_nvme_fused_status | ( | const struct spdk_bdev_io * | bdev_io, |
uint32_t * | cdw0, | ||
int * | first_sct, | ||
int * | first_sc, | ||
int * | second_sct, | ||
int * | second_sc ) |
Get the status of bdev_io as an NVMe status codes and command specific completion queue value for fused operations such as compare-and-write.
bdev_io | I/O to get the status from. |
cdw0 | Command specific completion queue value |
first_sct | Status Code Type return value for the first operation, as defined by the NVMe specification. |
first_sc | Status Code return value for the first operation, as defined by the NVMe specification. |
second_sct | Status Code Type return value for the second operation, as defined by the NVMe specification. |
second_sc | Status Code return value for the second operation, as defined by the NVMe specification. |
void spdk_bdev_io_get_nvme_status | ( | const struct spdk_bdev_io * | bdev_io, |
uint32_t * | cdw0, | ||
int * | sct, | ||
int * | sc ) |
Get the status of bdev_io as an NVMe status code and command specific completion queue value.
bdev_io | I/O to get the status from. |
cdw0 | Command specific completion queue value |
sct | Status Code Type return value, as defined by the NVMe specification. |
sc | Status Code return value, as defined by the NVMe specification. |
void spdk_bdev_io_get_scsi_status | ( | const struct spdk_bdev_io * | bdev_io, |
int * | sc, | ||
int * | sk, | ||
int * | asc, | ||
int * | ascq ) |
Get the status of bdev_io as a SCSI status code.
bdev_io | I/O to get the status from. |
sc | SCSI Status Code. |
sk | SCSI Sense Key. |
asc | SCSI Additional Sense Code. |
ascq | SCSI Additional Sense Code Qualifier. |
uint64_t spdk_bdev_io_get_seek_offset | ( | const struct spdk_bdev_io * | bdev_io | ) |
Get the result of a previous seek function.
After calling spdk_bdev_seek_data or spdk_bdev_seek_hole, call this function to retrieve the offset of next allocated data or next unallocated hole.
bdev_io | I/O to get the status from. |
bool spdk_bdev_io_type_supported | ( | struct spdk_bdev * | bdev, |
enum spdk_bdev_io_type | io_type ) |
Check whether the block device supports the I/O type.
bdev | Block device to check. |
io_type | The specific I/O type like read, write, flush, unmap. |
bool spdk_bdev_is_dif_check_enabled | ( | const struct spdk_bdev * | bdev, |
enum spdk_dif_check_type | check_type ) |
Check whether the DIF check type is enabled.
bdev | Block device to query. |
check_type | The specific DIF check type. |
bool spdk_bdev_is_dif_head_of_md | ( | const struct spdk_bdev * | bdev | ) |
Check whether DIF is set in the first 8/16 bytes or the last 8/16 bytes of metadata.
Note that this function is valid only if DIF type is not SPDK_DIF_DISABLE.
bdev | Block device to query. |
bool spdk_bdev_is_md_interleaved | ( | const struct spdk_bdev * | bdev | ) |
Query whether metadata is interleaved with block data or separated with block data.
Note this function is valid only if there is metadata.
bdev | Block device to query. |
bool spdk_bdev_is_md_separate | ( | const struct spdk_bdev * | bdev | ) |
Query whether metadata is interleaved with block data or separated from block data.
Note this function is valid only if there is metadata.
bdev | Block device to query. |
bool spdk_bdev_is_zoned | ( | const struct spdk_bdev * | bdev | ) |
Checks if bdev supports zoned namespace semantics.
bdev | Block device to query. |
Get the next registered block device.
prev | The current block device. |
Get the next block device without virtual block devices on top.
This function only traverses over block devices which have no virtual block devices on top of them, then get the next one.
prev | The current block device. |
int spdk_bdev_open_async | ( | const char * | bdev_name, |
bool | write, | ||
spdk_bdev_event_cb_t | event_cb, | ||
void * | event_ctx, | ||
struct spdk_bdev_open_async_opts * | opts, | ||
spdk_bdev_open_async_cb_t | open_cb, | ||
void * | open_cb_arg ) |
Open a block device for I/O operations asynchronously with options.
bdev_name | Block device name to open. |
write | true is read/write access requested, false if read-only |
event_cb | Notification callback to be called when the bdev triggers asynchronous event such as bdev removal. This will always be called on the same thread that spdk_bdev_open_async() was called on. In case of removal event the descriptor will have to be manually closed to make the bdev unregister proceed. |
event_ctx | param for event_cb. |
opts | Options for asynchronous block device open. If NULL, default values are used. |
open_cb | Open callback. |
open_cb_arg | Parameter for open_cb. |
int spdk_bdev_open_ext | ( | const char * | bdev_name, |
bool | write, | ||
spdk_bdev_event_cb_t | event_cb, | ||
void * | event_ctx, | ||
struct spdk_bdev_desc ** | desc ) |
Open a block device for I/O operations.
bdev_name | Block device name to open. |
write | true is read/write access requested, false if read-only |
event_cb | notification callback to be called when the bdev triggers asynchronous event such as bdev removal. This will always be called on the same thread that spdk_bdev_open_ext() was called on. In case of removal event the descriptor will have to be manually closed to make the bdev unregister proceed. |
event_ctx | param for event_cb. |
desc | output parameter for the descriptor when operation is successful |
int spdk_bdev_open_ext_v2 | ( | const char * | bdev_name, |
bool | write, | ||
spdk_bdev_event_cb_t | event_cb, | ||
void * | event_ctx, | ||
struct spdk_bdev_open_opts * | opts, | ||
struct spdk_bdev_desc ** | desc ) |
Open a block device for I/O operations with options.
bdev_name | Block device name to open. |
write | true is read/write access requested, false if read-only |
event_cb | notification callback to be called when the bdev triggers asynchronous event such as bdev removal. This will always be called on the same thread that spdk_bdev_open_ext() was called on. In case of removal event the descriptor will have to be manually closed to make the bdev unregister proceed. |
event_ctx | param for event_cb. |
opts | Option for block device open. If NULL, default values are used. |
desc | output parameter for the descriptor when operation is successful |
void spdk_bdev_open_opts_init | ( | struct spdk_bdev_open_opts * | opts, |
size_t | opts_size ) |
Initialize bdev open options.
opts | Bdev open options. |
opts_size | Must be set to sizeof(struct spdk_bdev_open_opts). |
int spdk_bdev_queue_io_wait | ( | struct spdk_bdev * | bdev, |
struct spdk_io_channel * | ch, | ||
struct spdk_bdev_io_wait_entry * | entry ) |
Add an entry into the calling thread's queue to be notified when an spdk_bdev_io becomes available.
When one of the bdev I/O Submit Functions returns -ENOMEM, it means the spdk_bdev_io buffer pool has no available buffers. This function may be called to register a callback to be notified when a buffer becomes available on the calling thread.
The callback function will always be called on the same thread as this function was called.
This function must only be called immediately after one of the bdev I/O Submit Functions returns -ENOMEM.
bdev | Block device. The block device that the caller will submit an I/O to when the callback is invoked. Must match the bdev member in the entry parameter. |
ch | I/O channel. Obtained by calling spdk_bdev_get_io_channel(). |
entry | Data structure allocated by the caller specifying the callback function and argument. |
void spdk_bdev_set_qd_sampling_period | ( | struct spdk_bdev * | bdev, |
uint64_t | period ) |
Enable or disable queue depth sampling for this bdev.
Enables queue depth sampling when period is greater than 0. Disables it when the period is equal to zero. The resulting queue depth is stored in the spdk_bdev object as measured_queue_depth.
bdev | Block device on which to enable queue depth tracking. |
period | The period at which to poll this bdev's queue depth. If this is set to zero, polling will be disabled. |
void spdk_bdev_set_qos_rate_limits | ( | struct spdk_bdev * | bdev, |
uint64_t * | limits, | ||
void(* | cb_fn )(void *cb_arg, int status), | ||
void * | cb_arg ) |
Set the quality of service rate limits on a bdev.
bdev | Block device. |
limits | Pointer to the QoS rate limits array which holding the limits. |
cb_fn | Callback function to be called when the QoS limit has been updated. |
cb_arg | Argument to pass to cb_fn. |
The limits are ordered based on the spdk_bdev_qos_rate_limit_type enum.
int spdk_bdev_set_timeout | ( | struct spdk_bdev_desc * | desc, |
uint64_t | timeout_in_sec, | ||
spdk_bdev_io_timeout_cb | cb_fn, | ||
void * | cb_arg ) |
Set a time limit for the timeout IO of the bdev and timeout callback.
We can use this function to enable/disable the timeout handler. If the timeout_in_sec > 0 then it means to enable the timeout IO handling or change the time limit. If the timeout_in_sec == 0 it means to disable the timeout IO handling. If you want to enable or change the timeout IO handle you need to specify the spdk_bdev_io_timeout_cb it means the upper user determines what to do if you meet the timeout IO, for example, you can reset the device or abort the IO. Note: This function must run in the desc's thread.
desc | Block device descriptor. |
timeout_in_sec | Timeout value |
cb_fn | Bdev IO timeout callback |
cb_arg | Callback argument |
void spdk_bdev_subsystem_config_json | ( | struct spdk_json_write_ctx * | w | ) |
Get the full configuration options for the registered block device modules and created bdevs.
w | pointer to a JSON write context where the configuration will be written. |
int spdk_bdev_wait_for_examine | ( | spdk_bdev_wait_for_examine_cb | cb_fn, |
void * | cb_arg ) |
Report when all bdevs finished the examine process.
The registered cb_fn will be called just once. This function needs to be called again to receive further reports on examine process.
cb_fn | Callback function. |
cb_arg | Callback argument. |
int spdk_bdev_zcopy_end | ( | struct spdk_bdev_io * | bdev_io, |
bool | commit, | ||
spdk_bdev_io_completion_cb | cb, | ||
void * | cb_arg ) |
Submit a request to release a data buffer representing a range of blocks.
bdev_io | I/O request returned in the completion callback of spdk_bdev_zcopy_start(). |
commit | Whether to commit the data in the buffers to the blocks before releasing. The data does not need to be committed if it was not modified. |
cb | Called when the request is complete. |
cb_arg | Argument passed to cb. |
int spdk_bdev_zcopy_start | ( | struct spdk_bdev_desc * | desc, |
struct spdk_io_channel * | ch, | ||
struct iovec * | iov, | ||
int | iovcnt, | ||
uint64_t | offset_blocks, | ||
uint64_t | num_blocks, | ||
bool | populate, | ||
spdk_bdev_io_completion_cb | cb, | ||
void * | cb_arg ) |
Submit a request to acquire a data buffer that represents the given range of blocks.
The data buffer is placed in the spdk_bdev_io structure and can be obtained by calling spdk_bdev_io_get_iovec().
desc | Block device descriptor |
ch | I/O channel. Obtained by calling spdk_bdev_get_io_channel(). |
iov | A scatter gather list to be populated with the buffers |
iovcnt | The maximum number of elements in iov. |
offset_blocks | The offset, in blocks, from the start of the block device. |
num_blocks | The number of blocks. |
populate | Whether the data buffer should be populated with the data at the given blocks. Populating the data buffer can be skipped if the user writes new data to the entire buffer. |
cb | Called when the request is complete. |
cb_arg | Argument passed to cb. |
int spdk_for_each_bdev | ( | void * | ctx, |
spdk_for_each_bdev_fn | fn ) |
Call the provided callback function for every registered block device.
If fn returns negated errno, spdk_for_each_bdev() terminates iteration.
spdk_for_each_bdev() opens before and closes after executing the provided callback function for each bdev internally.
ctx | Context passed to the callback function. |
fn | Callback function for each block device. |
int spdk_for_each_bdev_leaf | ( | void * | ctx, |
spdk_for_each_bdev_fn | fn ) |
Call the provided callback function for every block device without virtual block devices on top.
spdk_for_each_bdev_leaf() opens before and closes after executing the provided callback function for each unclaimed bdev internally.
ctx | Context passed to the callback function. |
fn | Callback function for each block device without virtual block devices on top. |