From: Mark Syms <mark.syms@cloud.com>
To: <agruenba@redhat.com>
Cc: <gfs2@lists.linux.dev>, <ross.lagerwall@cloud.com>,
Mark Syms <mark.syms@cloud.com>
Subject: [PATCH] CA-411820: add STATX_DIOALIGN support to GFS2
Date: Mon, 2 Jun 2025 16:22:01 +0100 [thread overview]
Message-ID: <20250602152201.958425-1-mark.syms@cloud.com> (raw)
Inspiration taken from 8434ef1d8aa but in simplified form. 8434ef1d8aa
makes the response conditional on the result from `ext4_dio_alignment`.
It is not clear if similar discrimination needs to be performed for
GFS2 or if the iomap defaults will be generally suitable. In tests
performed with XenServer this does appear to be the case.
Signed-off-by: Mark Syms <mark.syms@cloud.com>
---
fs/gfs2/inode.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 187d789a8f1e..9310ecfe1f15 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -2172,6 +2172,19 @@ static int gfs2_getattr(struct mnt_idmap *idmap,
generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
+ /*
+ * Return the DIO alignment restrictions if requested. We only return
+ * this information when requested.
+ */
+ if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) {
+ struct block_device *bdev = inode->i_sb->s_bdev;
+
+ stat->result_mask |= STATX_DIOALIGN;
+ /* iomap defaults */
+ stat->dio_mem_align = bdev_dma_alignment(bdev) + 1;
+ stat->dio_offset_align = bdev_logical_block_size(bdev);
+ }
+
if (gfs2_holder_initialized(&gh))
gfs2_glock_dq_uninit(&gh);
--
2.49.0
reply other threads:[~2025-06-02 15:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250602152201.958425-1-mark.syms@cloud.com \
--to=mark.syms@cloud.com \
--cc=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=ross.lagerwall@cloud.com \
/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