From: Keith Busch <kbusch@meta.com>
To: <linux-block@vger.kernel.org>, <linux-ext4@vger.kernel.org>,
<linux-f2fs-devel@lists.sourceforge.net>,
<linux-fsdevel@vger.kernel.org>, <linux-xfs@vger.kernel.org>
Cc: <axboe@kernel.dk>, <jack@suse.cz>, <brauner@kernel.org>,
<cem@kernel.org>, <jaegeuk@kernel.org>, <aalbersh@kernel.org>,
<tytso@mit.edu>, Keith Busch <kbusch@kernel.org>
Subject: [PATCHv2 3/5] xfs: report direct io attributes through file_getattr
Date: Fri, 10 Jul 2026 14:06:44 -0700 [thread overview]
Message-ID: <20260710210646.3576365-4-kbusch@meta.com> (raw)
In-Reply-To: <20260710210646.3576365-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
Fill in the direct io alignment attributes for regular files, reporting
the larger write alignment for CoW inodes.
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
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
next prev parent reply other threads:[~2026-07-10 21:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 21:06 [PATCHv2 0/5] direct-io file extended attributes Keith Busch
2026-07-10 21:06 ` [PATCHv2 1/5] fs: add direct io attributes to file_getattr Keith Busch
2026-07-10 21:06 ` [PATCHv2 2/5] block: report direct io attributes through file_getattr Keith Busch
2026-07-10 21:06 ` Keith Busch [this message]
2026-07-10 21:06 ` [PATCHv2 4/5] ext4: " Keith Busch
2026-07-10 21:06 ` [PATCHv2 5/5] f2fs: " Keith Busch
2026-07-10 21:53 ` [f2fs-dev] [PATCHv2 0/5] direct-io file extended attributes Eric Biggers
2026-07-10 22:58 ` Keith Busch
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=20260710210646.3576365-4-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=aalbersh@kernel.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=jack@suse.cz \
--cc=jaegeuk@kernel.org \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
/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