]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: move inode copy-on-write predicates to xfs_inode.[ch]
authorDarrick J. Wong <djwong@kernel.org>
Tue, 2 Jul 2024 18:22:31 +0000 (11:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 2 Jul 2024 18:36:55 +0000 (11:36 -0700)
Move these inode predicate functions to xfs_inode.[ch] since they're not
reflink functions.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.h
fs/xfs/xfs_reflink.h

index fd1a59af6cbbc20bcd466c820b339f2a217dd5c9..dd2b80d5d34440a3a5b81cf161f7652e63e2cacc 100644 (file)
@@ -4297,3 +4297,11 @@ xfs_inode_alloc_unitsize(
 
        return XFS_FSB_TO_B(ip->i_mount, blocks);
 }
+
+/* Should we always be using copy on write for file writes? */
+bool
+xfs_is_always_cow_inode(
+       struct xfs_inode        *ip)
+{
+       return ip->i_mount->m_always_cow && xfs_has_reflink(ip->i_mount);
+}
index 292b90b5f2ac8479f8afa2be5bae71092f714461..e97b2b838c69b2caaf3a8ac9bbd9155921ff9e09 100644 (file)
@@ -292,6 +292,13 @@ static inline bool xfs_is_metadata_inode(struct xfs_inode *ip)
                xfs_is_quota_inode(&mp->m_sb, ip->i_ino);
 }
 
+bool xfs_is_always_cow_inode(struct xfs_inode *ip);
+
+static inline bool xfs_is_cow_inode(struct xfs_inode *ip)
+{
+       return xfs_is_reflink_inode(ip) || xfs_is_always_cow_inode(ip);
+}
+
 /*
  * Check if an inode has any data in the COW fork.  This might be often false
  * even for inodes with the reflink flag when there is no pending COW operation.
index 65c5dfe17ecf7fc95c6863a121f68545bc9acd70..fb55e4ce49fa1019d2c9e6c4224c4bd7ccc55eee 100644 (file)
@@ -6,16 +6,6 @@
 #ifndef __XFS_REFLINK_H
 #define __XFS_REFLINK_H 1
 
-static inline bool xfs_is_always_cow_inode(struct xfs_inode *ip)
-{
-       return ip->i_mount->m_always_cow && xfs_has_reflink(ip->i_mount);
-}
-
-static inline bool xfs_is_cow_inode(struct xfs_inode *ip)
-{
-       return xfs_is_reflink_inode(ip) || xfs_is_always_cow_inode(ip);
-}
-
 extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip,
                struct xfs_bmbt_irec *irec, bool *shared);
 int xfs_bmap_trim_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap,