Linux 6.1 Adding Support To statx() For Reporting Direct I/O Alignment Details
For months there has been work to extend statx to report I/O alignment information as a way for user-space to find out these details in a much easier way. With Linux 6.1 those direct I/O (DIO) alignment attribute bits are ready for mainline.
Google engineer Eric Biggers sent in this pull request to Linus Torvalds with the STATX_DIOALIGN addition. Biggers sums it up elegantly as:
Make statx() support reporting direct I/O (DIO) alignment information. This provides a generic interface for userspace programs to determine whether a file supports DIO, and if so with what alignment restrictions. Specifically, STATX_DIOALIGN works on block devices, and on regular files when their containing filesystem has implemented support.
An interface like this has been requested for years, since the conditions for when DIO is supported in Linux have gotten increasingly complex over time. Today, DIO support and alignment requirements can be affected by various filesystem features such as multi-device support, data journalling, inline data, encryption, verity, compression, checkpoint disabling, log-structured mode, etc. Further complicating things, Linux v6.0 relaxed the traditional rule of DIO needing to be aligned to the block device's logical block size; now user buffers (but not file offsets) only need to be aligned to the DMA alignment.
The approach of uplifting the XFS specific ioctl XFS_IOC_DIOINFO was discarded in favor of creating a clean new interface with statx().
Thus another notable addition on the way for Linux 6.1.