[f2fs-dev] [PATCHv2 3/5] xfs: report direct io attributes through file_getattr
Keith Busch via Linux-f2fs-devel <[email protected]> Fri, 10 Jul 2026 14:06:44 -0700
| Newsgroups | net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
From: Keith Busch <[email protected]> Fill in the direct io alignment attributes for regular files, reporting the larger write alignment for CoW inodes. Signed-off-by: Keith Busch <[email protected]> --- fs/xfs/xfs_ioctl.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 1b53701bebea1..d585242a8fe9f 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -49,6 +49,7 @@ #include <linux/mount.h> #include <linux/fileattr.h> +#include <linux/blkdev.h> /* Return 0 on success or positive error */ int @@ -468,6 +469,29 @@ xfs_ioc_rtgroup_geometry( * Linux extended inode flags interface. */ +static void +xfs_fill_fsxattr_dio( + struct xfs_inode *ip, + int whichfork, + struct file_kattr *fa) +{ + struct xfs_buftarg *target; + + if (whichfork != XFS_DATA_FORK || !S_ISREG(VFS_I(ip)->i_mode)) + return; + + target = xfs_inode_buftarg(ip); + bdev_fill_dio_attr(target->bt_bdev, fa); + /* + * CoW inodes must write whole allocation units out of place, so report + * the larger write alignment while leaving the smaller read alignment + * from the queue limits in place. + */ + if (xfs_is_cow_inode(ip)) + fa->fsx_dio_offset_align = xfs_inode_alloc_unitsize(ip); + fa->fsx_xflags |= FS_XFLAG_DIO; +} + static void xfs_fill_fsxattr( struct xfs_inode *ip, @@ -517,6 +541,8 @@ xfs_fill_fsxattr( fa->fsx_nextents = xfs_iext_count(ifp); else fa->fsx_nextents = xfs_ifork_nextents(ifp); + + xfs_fill_fsxattr_dio(ip, whichfork, fa); } STATIC int -- 2.53.0-Meta _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel