[LTP] [PATCH 2/3] syscalls/statx10: Add basic test for STATX_DIOALIGN

xuyang2018.jy@fujitsu.com xuyang2018.jy@fujitsu.com
Mon Apr 3 03:24:07 CEST 2023


Hi Eric

on 2023/04/01 3:29, Eric Biggers wrote:
> On Fri, Mar 31, 2023 at 12:56:47PM +0000, xuyang2018.jy@fujitsu.com wrote:
>>> Thanks for writing a test for STATX_DIOALIGN!
>>>
>>> However, the above code isn't actually a valid test, since stx_dio_mem_align and
>>> stx_dio_offset_align will be 0 if the file doesn't support DIO.  This is
>>> documented in the statx(2) manual page.
>>
>>    I have reported TCONF in setup when fail to open a file with O_DIRECT.
> 
> Unfortunately that does not work either, as the behavior for when direct I/O is
> unsupported is not standardized.  Some filesystems do indeed return -EINVAL for
> open(O_DIRECT).  However, others just treat O_DIRECT as a hint and fall back to
> buffered I/O.  And some filesystems even implement the former behavior for some
> files and the latter behavior for other files...
> 
> Note that this was actually one of the motivations for STATX_DIOALIGN.
> STATX_DIOALIGN tells you whether direct I/O is "really" supported, as opposed to
> being "supported" with a buffered I/O fallback.

Thanks for your explaination. IMO, ext4 and xfs should supported DIO.

I think I can test STATX_DIOALIGN only on ext4 and xfs (xfs can use 
XFS_IOC_DIOINFO ioctl to verify dio alignment information ) instead of 
all filesystem.

What do you think about it?

> 
>>> Filesystems aren't guaranteed to
>>> support DIO, if they do, they aren't guaranteed to support it on all files.
>>
>> In this case, I only test a regular file.
> 
> It is possible that on a single filesystem, direct I/O is supported on some
> regular files but not others.  It is also possible that files on the same
> filesystem have different direct I/O alignment restrictions.
> 
> Likewise, this was part of the motivation for STATX_DIOALIGN.

Understand, If only test ext4 and xfs,  except for regular file, Which 
file type does I should test?  device file, link file...


Best Regards
Yang Xu
> 
> - Eric


More information about the ltp mailing list