Linux 6.1 Adding Support To statx() For Reporting Direct I/O Alignment Details

Written by Michael Larabel in Linux Kernel on 3 October 2022 at 05:42 AM EDT. Add A Comment
LINUX KERNEL --
Mainlined back in 2017 was the statx() call for reporting enhanced file information and stats like finally reporting a file's creation time, data version numbers, and other attributes. Statx has continued evolving since its introduction in Linux 4.11 and now for Linux 6.1 is being expected to support reporting direct I/O alignment information.

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.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week