Skip to main content

Module dio_align

Module dio_align 

Source
Available on crate feature async only.
Expand description

O_DIRECT alignment discovery.

O_DIRECT requires the file offset, the transfer length, and the buffer address to be aligned.

Sources, in order of accuracy:

  1. statx(STATX_DIOALIGN) (Linux 6.1+) - authoritative, per-file, and distinguishes memory alignment from offset/length alignment. It can also say definitively that a file does not support direct I/O.
  2. /sys/dev/block/<major>:<minor>/queue/logical_block_size - the device sector size. Right for most filesystems, but misses cases where the filesystem imposes something stricter.

When neither can answer, the alignment stays unknown and the caller reads through the page cache.

Structsยง

DioAlign