nvm_async - Async. Controls

When using the nvm_cmd option NVM_CMD_ASYNC, then use these functions to steer the asynchronous mechanics.

nvm_async_cmd_ctx

struct nvm_async_cmd_ctx

IO ASYNC command context per IO, setup this struct inside nvm_ret per call to the nvm_cmd IO functions and set the CMD option NVM_CMD_ASYNC.

See
nvm_async_cb
See
nvm_async_init

Public Members

struct nvm_async_ctx* ctx

from nvm_async_init

nvm_async_cb cb

User provided callback function.

void* cb_arg

User provided callback arguments.

nvm_async_ctx

struct nvm_async_ctx

Opaque asynchronous context as returned by ‘nvm_async_init’.

See
nvm_async_init
See
nvm_async_term

nvm_async_poke

int nvm_async_poke(struct nvm_dev * dev, struct nvm_async_ctx * ctx, uint32_t max)

Process completions from the given ASYNC context.

Set process ‘max’ to limit number of completions, 0 means no max.

Return
On success, number of completions processed, may be 0. On error, -1 is returned and errno set to indicate the error.

nvm_async_term

int nvm_async_term(struct nvm_dev * dev, struct nvm_async_ctx * ctx)

Tear down the given ASYNC context.

nvm_async_wait

int nvm_async_wait(struct nvm_dev * dev, struct nvm_async_ctx * ctx)

Wait for completion of all outstanding commands in the given ‘ctx’.

Return
On success, number of completions processed, may be 0. On error, -1 is returned and errno set to indicate the error.

nvm_async_init

struct nvm_async_ctx* nvm_async_init(struct nvm_dev * dev, uint32_t depth, uint16_t flags)

Allocate an asynchronous context for command submission of the given depth for submission of commands to the given device.

Parameters
  • dev: Associated device
  • depth: Maximum iodepth / qdepth, maximum number of outstanding commands of the returned context
  • flags: TBD

nvm_async_get_depth

uint32_t nvm_async_get_depth(struct nvm_async_ctx * ctx)

Get the I/O depth of the context.

Parameters
  • ctx: Asynchronous context

nvm_async_get_outstanding

uint32_t nvm_async_get_outstanding(struct nvm_async_ctx * ctx)

Get the number of outstanding I/O.

Parameters
  • ctx: Asynchronous context