]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: hoist project id get/set functions to libxfs
authorDarrick J. Wong <djwong@kernel.org>
Tue, 2 Jul 2024 18:22:33 +0000 (11:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 2 Jul 2024 18:36:56 +0000 (11:36 -0700)
Move the project id get and set functions into libxfs.

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

index ed5e1a9b4b8c6315032b7daaee416c347b89cabc..3b5397a3f34f2ac843d30ddbf48845bf70e14ccf 100644 (file)
@@ -122,3 +122,13 @@ xfs_ip2xflags(
                flags |= FS_XFLAG_HASATTR;
        return flags;
 }
+
+prid_t
+xfs_get_initial_prid(struct xfs_inode *dp)
+{
+       if (dp->i_diflags & XFS_DIFLAG_PROJINHERIT)
+               return dp->i_projid;
+
+       /* Assign to the root project by default. */
+       return 0;
+}
index 6ad1898a0f73ffc619187d7443772fcea56baa73..f7e4d5a8235dda8562621db20faf27248a6fe70f 100644 (file)
@@ -11,4 +11,6 @@ uint64_t      xfs_flags2diflags2(struct xfs_inode *ip, unsigned int xflags);
 uint32_t       xfs_dic2xflags(struct xfs_inode *ip);
 uint32_t       xfs_ip2xflags(struct xfs_inode *ip);
 
+prid_t         xfs_get_initial_prid(struct xfs_inode *dp);
+
 #endif /* __XFS_INODE_UTIL_H__ */
index b20768962e8d6e6ba352d5267949d7097ef81c2a..15ab7a1c79a608690a5d24f6a6d91e7b5d72f8fc 100644 (file)
@@ -271,15 +271,6 @@ xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned long flags)
        return ret;
 }
 
-static inline prid_t
-xfs_get_initial_prid(struct xfs_inode *dp)
-{
-       if (dp->i_diflags & XFS_DIFLAG_PROJINHERIT)
-               return dp->i_projid;
-
-       return XFS_PROJID_DEFAULT;
-}
-
 static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
 {
        return ip->i_diflags2 & XFS_DIFLAG2_REFLINK;
index ac355328121ac9f4360b97c87aaa43d862979d51..54a098fe728584d6f32875bc6e00205171a23ce5 100644 (file)
@@ -135,8 +135,6 @@ typedef __u32                       xfs_nlink_t;
  */
 #define __this_address ({ __label__ __here; __here: barrier(); &&__here; })
 
-#define XFS_PROJID_DEFAULT     0
-
 #define howmany(x, y)  (((x)+((y)-1))/(y))
 
 static inline void delay(long ticks)