Re: [PATCH v3 1/8] statx: add direct I/O alignment information

Eric Biggers
2022-06-23T18:18:42Z

On Thu, Jun 23, 2022 at 08:58:12AM -0700, Darrick J. Wong wrote:
> > diff --git a/include/linux/stat.h b/include/linux/stat.h
> > index 7df06931f25d8..ff277ced50e9f 100644
> > --- a/include/linux/stat.h
> > +++ b/include/linux/stat.h
> > @@ -50,6 +50,8 @@ struct kstat {
> > struct timespec64 btime; /* File creation time */
> > u64 blocks;
> > u64 mnt_id;
> > + u32 dio_mem_align;
> > + u32 dio_offset_align;
>
> Hmm. Does the XFS port of XFS_IOC_DIOINFO to STATX_DIOALIGN look like
> this?
>
> struct xfs_buftarg *target = xfs_inode_buftarg(ip);
>
> kstat.dio_mem_align = target->bt_logical_sectorsize;
> kstat.dio_offset_align = target->bt_logical_sectorsize;
> kstat.result_mask |= STATX_DIOALIGN;

Yes, I think so.

However, if we need more fields as Avi Kivity requested at
https://lore.kernel.org/r/6c06b2d4-2d96-c4a6-7aca-5147a91e7cf2@scylladb.com
that is going to complicate things. I haven't had a chance to look
into whether those extra fields are really needed. Your opinion on whether XFS
(and any other filesystem) needs them would be appreciated.

>
> And I guess you're tabling the "optimal" IO discussions for now, because
> there are too many variants of what that means?
>

Yes, that's omitted for now due to the apparent redundancy with stx_blksize.

- Eric