Skip to content

Commit 61a223d

Browse files
committed
xfs: support STATX_DIOALIGN
Add support for STATX_DIOALIGN to xfs, so that direct I/O alignment restrictions are exposed to userspace in a generic way. Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c8c0227 commit 61a223d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fs/xfs/xfs_iops.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,16 @@ xfs_vn_getattr(
604604
stat->blksize = BLKDEV_IOSIZE;
605605
stat->rdev = inode->i_rdev;
606606
break;
607+
case S_IFREG:
608+
if (request_mask & STATX_DIOALIGN) {
609+
struct xfs_buftarg *target = xfs_inode_buftarg(ip);
610+
struct block_device *bdev = target->bt_bdev;
611+
612+
stat->result_mask |= STATX_DIOALIGN;
613+
stat->dio_mem_align = bdev_dma_alignment(bdev) + 1;
614+
stat->dio_offset_align = bdev_logical_block_size(bdev);
615+
}
616+
fallthrough;
607617
default:
608618
stat->blksize = xfs_stat_blksize(ip);
609619
stat->rdev = 0;

0 commit comments

Comments
 (0)