Skip to content

Commit 468210e

Browse files
Christoph Hellwigbrauner
authored andcommitted
xfs: report larger dio alignment for COW inodes
For I/O to reflinked blocks we always need to write an entire new file system block, and the code enforces the file system block alignment for the entire file if it has any reflinked blocks. Mirror the larger value reported in the statx in the dio_offset_align in the xfs-specific XFS_IOC_DIOINFO ioctl for the same reason. Don't bother adding a new field for the read alignment to this legacy ioctl as all new users should use statx instead. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 7422bbd commit 468210e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

fs/xfs/xfs_ioctl.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,16 @@ xfs_file_ioctl(
12041204
struct xfs_buftarg *target = xfs_inode_buftarg(ip);
12051205
struct dioattr da;
12061206

1207-
da.d_mem = da.d_miniosz = target->bt_logical_sectorsize;
1207+
da.d_mem = target->bt_logical_sectorsize;
1208+
1209+
/*
1210+
* See xfs_report_dioalign() for an explanation about why this
1211+
* reports a value larger than the sector size for COW inodes.
1212+
*/
1213+
if (xfs_is_cow_inode(ip))
1214+
da.d_miniosz = xfs_inode_alloc_unitsize(ip);
1215+
else
1216+
da.d_miniosz = target->bt_logical_sectorsize;
12081217
da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1);
12091218

12101219
if (copy_to_user(arg, &da, sizeof(da)))

0 commit comments

Comments
 (0)