Sync. I/O via block ioctl()#

In case your device is not an NVMe device, then there is no NVMe-driver ioctl() to make use of. xNVMe will then try to utilize the Linux Block Layer and treat a given block device as a NVMe device via shim-layer for NVMe admin commands such as identify and get-features.

Regular Block Devices#

A brief example of checking this:

# Create a NULL Block instance
modprobe null_blk nr_devices=1
# Open and query the NULL Block instance with xNVMe
xnvme info /dev/nullb0
# Remove the NULL Block instance
modprobe -r null_blk

Yielding:

xnvme_dev:
  xnvme_ident:
    uri: '/dev/nullb0'
    dtype: 0x3
    nsid: 0x1
    csi: 0x1f
  xnvme_be:
    admin: {id: 'block'}
    sync: {id: 'block'}
    async: {id: 'emu'}
    attr: {name: 'linux'}
  xnvme_opts:
    be: 'linux'
    mem: 'FIX-ID-VS-MIXIN-NAME'
    dev: 'FIX-ID-VS-MIXIN-NAME'
    admin: 'block'
    sync: 'block'
    async: 'emu'
    oflags: 0x4
  xnvme_geo:
    type: XNVME_GEO_CONVENTIONAL
    npugrp: 1
    npunit: 1
    nzone: 1
    nsect: 524288000
    nbytes: 512
    nbytes_oob: 0
    tbytes: 268435456000
    mdts_nbytes: 65024
    lba_nbytes: 512
    lba_extended: 0
    ssw: 9

Zoned Block Devices#

Building on the Linux Block model, then the Zoned Block Device model is also utilized, specifically the following IOCTLs:

  • BLK_ZONE_REP_CAPACITY

  • BLKCLOSEZONE

  • BLKFINISHZONE

  • BLKOPENZONE

  • BLKRESETZONE

  • BLKGETNRZONES

  • BLKREPORTZONE

When available, then xNVMe can make use of the above IOCTLs. By doing so, xNVMe provides a unified API to Zoned storage devices, with full capabilities, regardless of whether the zoned storage device is NVMe/ ZNS, SMR, or some other form. And allows you to communicate efficiently with your device.

# Create a Zoned NULL Block instance
modprobe null_blk nr_devices=1 zoned=1
# Open and query the Zoned NULL Block instance with xNVMe
xnvme info /dev/nullb0
# Remove the Zoned NULL Block instance
modprobe -r null_blk

Yielding:

xnvme_dev:
  xnvme_ident:
    uri: '/dev/nullb0'
    dtype: 0x3
    nsid: 0x1
    csi: 0x2
  xnvme_be:
    admin: {id: 'block'}
    sync: {id: 'block'}
    async: {id: 'emu'}
    attr: {name: 'linux'}
  xnvme_opts:
    be: 'linux'
    mem: 'FIX-ID-VS-MIXIN-NAME'
    dev: 'FIX-ID-VS-MIXIN-NAME'
    admin: 'block'
    sync: 'block'
    async: 'emu'
    oflags: 0x4
  xnvme_geo:
    type: XNVME_GEO_ZONED
    npugrp: 1
    npunit: 1
    nzone: 1000
    nsect: 524288
    nbytes: 512
    nbytes_oob: 0
    tbytes: 268435456000
    mdts_nbytes: 65024
    lba_nbytes: 512
    lba_extended: 0
    ssw: 9