* [PATCH] CA-411820: add STATX_DIOALIGN support to GFS2
@ 2025-06-02 15:22 Mark Syms
0 siblings, 0 replies; only message in thread
From: Mark Syms @ 2025-06-02 15:22 UTC (permalink / raw)
To: agruenba; +Cc: gfs2, ross.lagerwall, Mark Syms
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-06-02 15:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-02 15:22 [PATCH] CA-411820: add STATX_DIOALIGN support to GFS2 Mark Syms
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox