From: Dave Chinner <david@fromorbit.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH] xfs: update XFS_IOC_DIOINFO memory alignment value
Date: Thu, 11 Jul 2024 10:36:37 +1000 [thread overview]
Message-ID: <20240711003637.2979807-1-david@fromorbit.com> (raw)
From: Dave Chinner <dchinner@redhat.com>
As of v6.0, the DIO memory buffer alignment is no longer aligned to
the logical sector size of the underlying block device. There is now
a specific DMA alignment parameter that memory buffers should be
aligned to. statx(STATX_DIOALIGN) gets this right, but
XFS_IOC_DIOINFO does not - it still uses the older fixed alignment
defined by the block device logical sector size.
This was found because the s390 DASD driver increased DMA alignment
to PAGE_SIZE in commit bc792884b76f ("s390/dasd: Establish DMA
alignment") and DIO aligned to logical sector sizes have started
failing on kernels with that commit. Fixing the "userspace fails
because device alignment constraints increased" issue is not XFS's
problem, but we really should be reporting the correct device memory
alignment in XFS_IOC_DIOINFO.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_ioctl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index f0117188f302..71eba4849e03 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1368,7 +1368,8 @@ xfs_file_ioctl(
struct xfs_buftarg *target = xfs_inode_buftarg(ip);
struct dioattr da;
- da.d_mem = da.d_miniosz = target->bt_logical_sectorsize;
+ da.d_mem = bdev_dma_alignment(target->bt_bdev);
+ da.d_miniosz = target->bt_logical_sectorsize;
da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1);
if (copy_to_user(arg, &da, sizeof(da)))
--
2.45.1
next reply other threads:[~2024-07-11 0:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 0:36 Dave Chinner [this message]
2024-07-11 2:52 ` [PATCH] xfs: update XFS_IOC_DIOINFO memory alignment value Darrick J. Wong
2024-07-11 4:03 ` Christoph Hellwig
2024-07-11 4:36 ` Darrick J. Wong
2024-07-11 4:44 ` Christoph Hellwig
2024-07-11 5:52 ` Dave Chinner
2024-07-11 5:51 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240711003637.2979807-1-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox