On Tue, Apr 02, 2019 at 10:44:38AM -0500, Eric Sandeen wrote: > pmem is byte addressable, and indeed byte-aligned DIO works on > a DAX file. So, teach XFS_IOC_DIOINFO to return the correct > alignment information if IS_DAX(inode). If it's a DAX filesystem, do we want to try to steer people towards things like 2MB pages since (in theory) we can get away with fewer page table mappings? And (seeing as that's mmap that cares, not directio) would advertising preferential page mapping sizes be more appropriate advertised in a different ioctl? --D > Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> > --- > > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c > index 6ecdbb3..35eae7d 100644 > --- a/fs/xfs/xfs_ioctl.c > +++ b/fs/xfs/xfs_ioctl.c > @@ -1919,12 +1919,21 @@ xfs_file_ioctl( > } > case XFS_IOC_DIOINFO: { > struct dioattr da; > - xfs_buftarg_t *target = > - XFS_IS_REALTIME_INODE(ip) ? > - mp->m_rtdev_targp : mp->m_ddev_targp; > > - da.d_mem = da.d_miniosz = target->bt_logical_sectorsize; > - da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1); > + if (IS_DAX(inode)) { > + /* pmem is byte addressable */ > + da.d_mem = 1; > + da.d_miniosz = 1; > + da.d_maxiosz = INT_MAX; > + } else { > + xfs_buftarg_t *target = > + XFS_IS_REALTIME_INODE(ip) ? > + mp->m_rtdev_targp : mp->m_ddev_targp; > + > + da.d_mem = target->bt_logical_sectorsize; > + da.d_miniosz = target->bt_logical_sectorsize; > + da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1); > + } > > if (copy_to_user(arg, &da, sizeof(da))) > return -EFAULT; >