From de7e6ba2a1e2daf24ac92ef3f01f760f9a040028 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 6 Oct 2024 06:30:30 +0200 Subject: [PATCH] xfs: add a helper to check if an inode sits on a zoned device Add a xfs_is_zoned_inode helper that returns true if an inode has the RT flag set and the file system is zoned. This will be used to key off zoned allocator behavior. Make xfs_is_always_cow_inode return true for zoned inodes as we always need to write out of place on zoned devices. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_inode.c | 3 ++- fs/xfs/xfs_inode.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index da2c861ec3b7..21072baedae5 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3084,5 +3084,6 @@ bool xfs_is_always_cow_inode( const struct xfs_inode *ip) { - return ip->i_mount->m_always_cow && xfs_has_reflink(ip->i_mount); + return xfs_is_zoned_inode(ip) || + (ip->i_mount->m_always_cow && xfs_has_reflink(ip->i_mount)); } diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 25bde5f91452..0ece40d38f4b 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -320,6 +320,11 @@ static inline bool xfs_is_internal_inode(const struct xfs_inode *ip) xfs_is_quota_inode(&mp->m_sb, ip->i_ino); } +static inline bool xfs_is_zoned_inode(const struct xfs_inode *ip) +{ + return xfs_has_zoned(ip->i_mount) && XFS_IS_REALTIME_INODE(ip); +} + bool xfs_is_always_cow_inode(const struct xfs_inode *ip); static inline bool xfs_is_cow_inode(const struct xfs_inode *ip) -- 2.50.1