Re: [PATCH v3 1/8] statx: add direct I/O alignment information
From: Eric Biggers
Date: Thu Jun 23 2022 - 15:29:35 EST
On Thu, Jun 23, 2022 at 10:23:20AM -0700, Eric Biggers wrote:
> 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.
>
By the way, the patchset "[PATCHv6 00/11] direct-io dma alignment"
(https://lore.kernel.org/linux-block/20220610195830.3574005-1-kbusch@xxxxxx/T/#u),
which is currently queued in linux-block/for-next for 5.20, will relax the user
buffer alignment requirement to the dma alignment for all filesystems using the
iomap direct I/O implementation. If that goes in, the XFS implementation of
STATX_DIOALIGN, as well as the ext4 and f2fs ones, will need to be changed
accordingly. Also, the existing XFS_IOC_DIOINFO will need to be changed.
- Eric