direct-io-alignment · shipping · also DIO alignment

Direct-I/O alignment

Direct-I/O alignment is the per-file constraint on memory addresses, file offsets and I/O segment lengths used for direct transfers.

Related Observatory article: Read on hesela.com

On Linux, inspect the returned statx mask before interpreting alignment fields. An absent STATX_DIOALIGN bit means unknown, whereas reported zero base fields mean unsupported direct I/O. A nonzero read-specific field can relax read offset and length requirements without relaxing memory alignment. [1]

STATX_DIOALIGN is supported on block devices since Linux 6.1 and on regular files of ext4, f2fs and xfs since the same release. The read-specific field is supported by xfs on regular files since Linux 6.14. [1]

Without that query, alignment can only be inferred from the filesystem, file, device and kernel version. Linux 2.4 filesystems on block devices typically required multiples of the filesystem block size, often 4096 bytes. Linux 2.6.0 relaxed this to the logical block size, typically 512 bytes. Misaligned requests may fail with EINVAL or fall back to buffered I/O, and the Linux NFS client imposes no alignment. [2]

Relations

related
Direct I/O, Buffered I/O, Page cache, Partition alignment, I/O request size

Advantages

  • Makes direct-transfer eligibility explicit instead of assuming a universal sector size. [1, 2]

Limitations

  • Alignment metadata does not prove execution mode, atomicity or durability. [1]
  • Some filesystems serve misaligned direct requests through buffered I/O instead of failing them, so a completed request does not prove that the page cache was bypassed. [2]

Citations

  1. Linux man-pages: statx(2), returned masks and direct-I/O alignment fields. (accessed 2026-10-22)
  2. Linux man-pages: open(2), O_DIRECT alignment notes (accessed 2026-10-22)
Sources & caveats
  • statx-2 and open-2 are the Linux man-pages statx(2) and open(2) pages, read in the field descriptions and the O_DIRECT notes.
  • Linux 6.1, Linux 6.14 and the per-filesystem support come from statx-2.
  • 4096 bytes, 512 bytes, Linux 2.4 and 2.6.0, EINVAL and the NFS client rule come from open-2.

JSON: /data/terms/direct-io-alignment.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Direct-I/O alignment. Hesela. 2026-10-22. https://hesela.dev/terms/direct-io-alignment/