diff mbox series

[06/64] xfs: hoist project id get/set functions to libxfs

Message ID 172783101872.4036371.14985363676574940423.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [01/64] xfs: avoid redundant AGFL buffer invalidation | expand

Commit Message

Darrick J. Wong Oct. 2, 2024, 1:09 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Source kernel commit: fcea5b35f36233c04003ab8b3eb081b5e20e1aa4

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>
---
 libxfs/xfs_inode_util.c |   10 ++++++++++
 libxfs/xfs_inode_util.h |    2 ++
 2 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/libxfs/xfs_inode_util.c b/libxfs/xfs_inode_util.c
index 868a77caf..0a9ea03e2 100644
--- a/libxfs/xfs_inode_util.c
+++ b/libxfs/xfs_inode_util.c
@@ -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;
+}
diff --git a/libxfs/xfs_inode_util.h b/libxfs/xfs_inode_util.h
index 6ad1898a0..f7e4d5a82 100644
--- a/libxfs/xfs_inode_util.h
+++ b/libxfs/xfs_inode_util.h
@@ -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__ */