[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241210125737.786928-8-john.g.garry@oracle.com>
Date: Tue, 10 Dec 2024 12:57:37 +0000
From: John Garry <john.g.garry@...cle.com>
To: brauner@...nel.org, djwong@...nel.org, cem@...nel.org, dchinner@...hat.com,
hch@....de, ritesh.list@...il.com
Cc: linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, martin.petersen@...cle.com,
John Garry <john.g.garry@...cle.com>
Subject: [PATCH v2 7/7] xfs: Update xfs_get_atomic_write_attr() for large atomic writes
Update xfs_get_atomic_write_attr() to take into account that rtvol can
support atomic writes spanning multiple FS blocks.
For non-rtvol, we are still limited in min and max by the blocksize.
Signed-off-by: John Garry <john.g.garry@...cle.com>
---
fs/xfs/xfs_iops.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 883ec45ae708..75fb3738cb76 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -572,18 +572,35 @@ xfs_stat_blksize(
return max_t(uint32_t, PAGE_SIZE, mp->m_sb.sb_blocksize);
}
+/* Returns max atomic write unit for a file, in bytes. */
+static unsigned int
+xfs_inode_atomicwrite_max(
+ struct xfs_inode *ip)
+{
+ struct xfs_mount *mp = ip->i_mount;
+
+ if (XFS_IS_REALTIME_INODE(ip))
+ return mp->m_rt_awu_max;
+
+ return mp->m_sb.sb_blocksize;
+}
+
void
xfs_get_atomic_write_attr(
struct xfs_inode *ip,
unsigned int *unit_min,
unsigned int *unit_max)
{
+ struct xfs_buftarg *target = xfs_inode_buftarg(ip);
+ unsigned int awu_max = xfs_inode_atomicwrite_max(ip);
+
if (!xfs_inode_can_atomicwrite(ip)) {
*unit_min = *unit_max = 0;
return;
}
- *unit_min = *unit_max = ip->i_mount->m_sb.sb_blocksize;
+ *unit_min = ip->i_mount->m_sb.sb_blocksize;
+ *unit_max = min(target->bt_bdev_awu_max, awu_max);
}
STATIC int
--
2.31.1
Powered by blists - more mailing lists