]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: add a helper to check if an inode sits on a zoned device
authorChristoph Hellwig <hch@lst.de>
Sun, 6 Oct 2024 04:30:30 +0000 (06:30 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 5 Nov 2024 08:29:52 +0000 (09:29 +0100)
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 <hch@lst.de>
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.h

index da2c861ec3b783bdc4f02479a6217c706a2626f6..21072baedae54d0bb1f37c916c6cdfd1c1b93410 100644 (file)
@@ -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));
 }
index 25bde5f91452ca433158498f76eb1427c0ef2e22..0ece40d38f4bd02cbd97d5d5d59e2798339131f9 100644 (file)
@@ -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)