spdk_bdev_module Struct Reference

Block device module. More...

Collaboration diagram for spdk_bdev_module:

Data Structures

struct  __bdev_module_internal_fields
 Fields that are used by the internal bdev subsystem. More...
 

Data Fields

int(* module_init )(void)
 Initialization function for the module. More...
 
void(* init_complete )(void)
 Optional callback for modules that require notification of when the bdev subsystem has completed initialization. More...
 
void(* fini_start )(void)
 Optional callback for modules that require notification of when the bdev subsystem is starting the fini process. More...
 
void(* module_fini )(void)
 Finish function for the module. More...
 
int(* config_json )(struct spdk_json_write_ctx *w)
 Function called to return a text string representing the module-level JSON RPCs required to regenerate the current configuration. More...
 
const char * name
 Name for the modules being defined.
 
int(* get_ctx_size )(void)
 Returns the allocation size required for the backend for uses such as local command structs, local SGL, iovecs, or other user context.
 
void(* examine_config )(struct spdk_bdev *bdev)
 First notification that a bdev should be examined by a virtual bdev module. More...
 
void(* examine_disk )(struct spdk_bdev *bdev)
 Second notification that a bdev should be examined by a virtual bdev module. More...
 
bool async_init
 Denotes if the module_init function may complete asynchronously. More...
 
bool async_fini
 Denotes if the module_fini function may complete asynchronously. More...
 
bool async_fini_start
 Denotes if the fini_start function may complete asynchronously. More...
 
struct spdk_bdev_module::__bdev_module_internal_fields internal
 

Detailed Description

Block device module.

Field Documentation

◆ async_fini

bool spdk_bdev_module::async_fini

Denotes if the module_fini function may complete asynchronously.

If set to true finishing has to be explicitly completed by calling spdk_bdev_module_fini_done().

◆ async_fini_start

bool spdk_bdev_module::async_fini_start

Denotes if the fini_start function may complete asynchronously.

If set to true finishing has to be explicitly completed by calling spdk_bdev_module_fini_start_done().

◆ async_init

bool spdk_bdev_module::async_init

Denotes if the module_init function may complete asynchronously.

If set to true, the module initialization has to be explicitly completed by calling spdk_bdev_module_init_done().

◆ config_json

int(* spdk_bdev_module::config_json) (struct spdk_json_write_ctx *w)

Function called to return a text string representing the module-level JSON RPCs required to regenerate the current configuration.

This will include module-level configuration options, or methods to construct bdevs when one RPC may generate multiple bdevs (for example, an NVMe controller with multiple namespaces).

Per-bdev JSON RPCs (where one "construct" RPC always creates one bdev) may be implemented here, or by the bdev's write_config_json function - but not both. Bdev module implementers may choose which mechanism to use based on the module's design.

Returns
0 on success or Bdev specific negative error code.

◆ examine_config

void(* spdk_bdev_module::examine_config) (struct spdk_bdev *bdev)

First notification that a bdev should be examined by a virtual bdev module.

Virtual bdev modules may use this to examine newly-added bdevs and automatically create their own vbdevs, but no I/O to device can be send to bdev at this point. Only vbdevs based on config files can be created here. This callback must make its decision to claim the module synchronously. It must also call spdk_bdev_module_examine_done() before returning. If the module needs to perform asynchronous operations such as I/O after claiming the bdev, it may define an examine_disk callback. The examine_disk callback will then be called immediately after the examine_config callback returns.

◆ examine_disk

void(* spdk_bdev_module::examine_disk) (struct spdk_bdev *bdev)

Second notification that a bdev should be examined by a virtual bdev module.

Virtual bdev modules may use this to examine newly-added bdevs and automatically create their own vbdevs. This callback may use I/O operations and finish asynchronously. Once complete spdk_bdev_module_examine_done() must be called.

◆ fini_start

void(* spdk_bdev_module::fini_start) (void)

Optional callback for modules that require notification of when the bdev subsystem is starting the fini process.

Called by the bdev library before starting to unregister the bdevs.

If a module claimed a bdev without presenting virtual bdevs on top of it, it has to release that claim during this call.

Modules are not required to define this function.

◆ init_complete

void(* spdk_bdev_module::init_complete) (void)

Optional callback for modules that require notification of when the bdev subsystem has completed initialization.

Modules are not required to define this function.

◆ module_fini

void(* spdk_bdev_module::module_fini) (void)

Finish function for the module.

Called by the bdev library after all bdevs for all modules have been unregistered. This allows the module to do any final cleanup before the bdev library finishes operation.

Modules are not required to define this function.

◆ module_init

int(* spdk_bdev_module::module_init) (void)

Initialization function for the module.

Called by the bdev library during startup.

Modules are required to define this function.


The documentation for this struct was generated from the following file: