nvm_addr - Addressing

nvm_addr

struct nvm_addr

Encapsulation of physical/hierarchical/geometric addressing in generic format.

Although the user need not worry about device specific address formats the user has to know and respect addressing within device specific geometric boundaries.

For that purpose one can use the struct nvm_geo of an struct nvm_dev to obtain device specific geometries.

Public Members

uint64_t sec

Sector address.

uint64_t pg

Page address.

uint64_t pl

Plane address.

uint64_t blk

Block address.

uint64_t lun

LUN address.

uint64_t ch

Channel address.

struct nvm_addr::@2::@4 g

Address packing and geometric accessors.

uint64_t sectr

Logical Sector in Chunk.

uint64_t chunk

Chunk in PU.

uint64_t punit

Parallel Unit (PU) in PUG.

uint64_t pugrp

Parallel Unit Group (PUG)

struct nvm_addr::@2::@5 l
uint64_t ppa

Address as raw value.

uint64_t val

Address as raw value.

union nvm_addr::@2 nvm_addr::@3

nvm_addr_check

int nvm_addr_check(struct nvm_addr addr, const struct nvm_dev * dev)

Checks whether the given address exceeds bounds of the geometry of the given device.

Return
A mask of exceeded boundaries
Parameters
  • addr: The addr to check
  • dev: The device of which to check geometric bounds against

nvm_addr_dev2gen

struct nvm_addr nvm_addr_dev2gen(struct nvm_dev * dev, uint64_t addr)

Converts an address, in device-format, to generic-format.

Return
Address in generic-format
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • addr: The address, in device-format, to convert

nvm_addr_dev2off

uint64_t nvm_addr_dev2off(struct nvm_dev * dev, uint64_t addr)

Converts an address, in device-format, to Linux Block Device offset.

Note
This is a helper for function for the LBD backend, as a library user you will most likely not have a use for it
Return
Physical address on lba-offset-format
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • addr: The physical address on device-format to convert

nvm_addr_gen2dev

uint64_t nvm_addr_gen2dev(struct nvm_dev * dev, struct nvm_addr addr)

Converts an address, in generic-format, to device-format.

Return
Address in device-format
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • addr: The address, in generic-format, to convert

nvm_addr_gen2lpo

uint64_t nvm_addr_gen2lpo(struct nvm_dev * dev, struct nvm_addr addr)

Compute log-page-offset (lpo) in the NVMe chunk-information get-log-page.

That is, the location of the chunk-descriptor in the log-page, for the chunk at the given address in generic-format

Note
This is a helper for function for nvm_cmd_rprt, as a library user you will most likely not have a use for it
Return
the log page offset (lpo) for the given addr

nvm_addr_gen2off

uint64_t nvm_addr_gen2off(struct nvm_dev * dev, struct nvm_addr addr)

Converts an address, in generic-format, to Linux Block Device offset.

Note
This is a helper for function for the LBD backend, as a library user you will most likely not have a use for it
Return
LBD offset
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • addr: The address, in generic-format, to convert

nvm_addr_lpo2gen

struct nvm_addr nvm_addr_lpo2gen(struct nvm_dev * dev, uint64_t lpo)

Inverse function of nvm_addr_gen2lpo

Note
This is a helper for function for nvm_cmd_rprt, as a library user you will most likely not have a use for it
Return
the page offset (lpo) for the given addr

nvm_addr_off2dev

uint64_t nvm_addr_off2dev(struct nvm_dev * dev, uint64_t addr)

Converts a Linux Block Device offset to an address in device-format.

Note
This is a helper for function for the LBD backend, as a library user you will most likely not have a use for it
Return
Physical address on lba-offset-format
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • addr: The physical address on device-format to convert

nvm_addr_off2gen

struct nvm_addr nvm_addr_off2gen(struct nvm_dev * dev, uint64_t off)

Converts a Linux Block Device offset to an address in generic-format.

Note
This is a helper for function for the LBD backend, as a library user you will most likely not have a use for it
Return
Address in generic-format
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • off: LBD offset

nvm_addr_pr

void nvm_addr_pr(const struct nvm_addr addr)

Prints a hexidecimal representation of the given address value.

nvm_addr_prn

void nvm_addr_prn(const struct nvm_addr * addr, unsigned int naddrs, const struct nvm_dev * dev)

Prints a humanly readable representation of the given list of addresses according to the geometry of the given device (spec 1.2 or 2.0)