[PATCH 04/22] xfs: hoist project id get/set functions

Darrick J. Wong
2019-01-01T02:19:35Z

Move the project id get and set functions into libxfs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/libxfs/xfs_inode_util.h | 29 +++++++++++++++++++++++++++++
fs/xfs/xfs_inode.h | 27 ---------------------------
fs/xfs/xfs_linux.h | 2 --
3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_inode_util.h b/fs/xfs/libxfs/xfs_inode_util.h
index 45f8c4869c4b..808e4322106e 100644
--- a/fs/xfs/libxfs/xfs_inode_util.h
+++ b/fs/xfs/libxfs/xfs_inode_util.h
@@ -14,4 +14,33 @@ uint64_t xfs_flags2diflags2(struct xfs_inode *ip, unsigned int xflags);
uint32_t xfs_dic2xflags(uint16_t di_flags, uint64_t di_flags2,
bool has_attr);

+/*
+ * Project quota id helpers (previously projid was 16bit only and using two
+ * 16bit values to hold new 32bit projid was chosen to retain compatibility
+ * with "old" filesystems).
+ */
+static inline prid_t
+xfs_get_projid(struct xfs_icdinode *id)
+{
+ return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo;
+}
+
+static inline void
+xfs_set_projid(struct xfs_icdinode *id, prid_t projid)
+{
+ id->di_projid_hi = (uint16_t) (projid >> 16);
+ id->di_projid_lo = (uint16_t) (projid & 0xffff);
+}
+
+#define XFS_PROJID_DEFAULT 0
+
+static inline prid_t
+xfs_get_initial_prid(struct xfs_icdinode *id)
+{
+ if (id->di_flags & XFS_DIFLAG_PROJINHERIT)
+ return xfs_get_projid(id);
+
+ return XFS_PROJID_DEFAULT;
+}
+
#endif /* __XFS_INODE_UTIL_H__ */
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index ca2623e0dd4f..fb55e3b74b34 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -165,33 +165,6 @@ xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)
return ret;
}

-/*
- * Project quota id helpers (previously projid was 16bit only
- * and using two 16bit values to hold new 32bit projid was chosen
- * to retain compatibility with "old" filesystems).
- */
-static inline prid_t
-xfs_get_projid(struct xfs_icdinode *id)
-{
- return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo;
-}
-
-static inline void
-xfs_set_projid(struct xfs_icdinode *id, prid_t projid)
-{
- id->di_projid_hi = (uint16_t) (projid >> 16);
- id->di_projid_lo = (uint16_t) (projid & 0xffff);
-}
-
-static inline prid_t
-xfs_get_initial_prid(struct xfs_icdinode *id)
-{
- if (id->di_flags & XFS_DIFLAG_PROJINHERIT)
- return xfs_get_projid(id);
-
- return XFS_PROJID_DEFAULT;
-}
-
static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
{
return ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK;
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index edbd5a210df2..f2835a9f0a16 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -138,8 +138,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)