Re: [PATCH v10 0/5] add support for direct I/O with fscrypt using blk-crypto

Dave Chinner
2022-01-23T23:03:39Z

On Thu, Jan 20, 2022 at 06:36:03PM -0800, Darrick J. Wong wrote:
> On Fri, Jan 21, 2022 at 10:57:55AM +1100, Dave Chinner wrote:
> Sure. How's this? I couldn't think of a real case of directio
> requiring different alignments for pos and bytecount, so the only real
> addition here is the alignment requirements for best performance.
>
> struct statx {
> ...
> /* 0x90 */
> __u64 stx_mnt_id;
>
> /* Memory buffer alignment required for directio, in bytes. */
> __u32 stx_dio_mem_align;

__32 stx_mem_align_dio;

(for consistency with suggestions below)

>
> /* File range alignment required for directio, in bytes. */
> __u32 stx_dio_fpos_align_min;

"fpos" is not really a user term - "offset" is the userspace term for
file position, and it's much less of a random letter salad if it's
named that way. Also, we don't need "min" in the name; the
description of the field in the man page can give all the gory
details about it being the minimum required alignment.

__u32 stx_offset_align_dio;

>
> /* 0xa0 */
>
> /* File range alignment needed for best performance, in bytes. */
> __u32 stx_dio_fpos_align_opt;

This is a common property of both DIO and buffered IO, so no need
for it to be dio-only property.

__u32 stx_offset_align_optimal;

>
> /* Maximum size of a directio request, in bytes. */
> __u32 stx_dio_max_iosize;

Unnecessary, it will always be the syscall max IO size, because the
internal DIO code will slice and dice it down to the max sizes the
hardware supports.

> #define STATX_DIRECTIO 0x00001000U /* Want/got directio geometry */
>
> How about that?

Mostly seems reasonable at a first look.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com