[3/5] xfs: hide inode geometry calculation helpers
diff mbox series

Message ID 155960227849.1194435.1190279904778498264.stgit@magnolia
State New
Headers show
Series
  • xfs: refactor inode geometry
Related show

Commit Message

Darrick J. Wong June 3, 2019, 10:51 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Hide all the inode geometry calculation helper functions since we now
cache all that in memory.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_ialloc.c |   23 +++++++++++++----------
 fs/xfs/libxfs/xfs_ialloc.h |   11 -----------
 2 files changed, 13 insertions(+), 21 deletions(-)

Patch
diff mbox series

diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 81d33ba10619..cff202d0ee4a 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -31,16 +31,23 @@ 
 #include "xfs_log.h"
 #include "xfs_rmap.h"
 
+/* Calculate and return the number of filesystem blocks per inode cluster */
+static inline int
+xfs_icluster_size_fsb(
+	struct xfs_mount	*mp)
+{
+	if (mp->m_sb.sb_blocksize >= M_IGEO(mp)->inode_cluster_size)
+		return 1;
+	return M_IGEO(mp)->inode_cluster_size >> mp->m_sb.sb_blocklog;
+}
 
-/*
- * Allocation group level functions.
- */
-int
+/* Compute the required inode cluster alignment. */
+static inline int
 xfs_ialloc_cluster_alignment(
 	struct xfs_mount	*mp)
 {
 	if (xfs_sb_version_hasalign(&mp->m_sb) &&
-	    mp->m_sb.sb_inoalignmt >= xfs_icluster_size_fsb(mp))
+	    mp->m_sb.sb_inoalignmt >= M_IGEO(mp)->blocks_per_cluster)
 		return mp->m_sb.sb_inoalignmt;
 	return 1;
 }
@@ -2819,11 +2826,7 @@  xfs_ialloc_setup_geometry(
 			igeo->cluster_align);
 
 	/* Set whether we're using inode alignment. */
-	if (xfs_sb_version_hasalign(&mp->m_sb) &&
-		mp->m_sb.sb_inoalignmt >= xfs_icluster_size_fsb(mp))
-		igeo->inoalign_mask = mp->m_sb.sb_inoalignmt - 1;
-	else
-		igeo->inoalign_mask = 0;
+	igeo->inoalign_mask = igeo->cluster_align - 1;
 
 	/*
 	 * If we are using stripe alignment, check whether
diff --git a/fs/xfs/libxfs/xfs_ialloc.h b/fs/xfs/libxfs/xfs_ialloc.h
index 455f65a2f1dd..2d61e0842f89 100644
--- a/fs/xfs/libxfs/xfs_ialloc.h
+++ b/fs/xfs/libxfs/xfs_ialloc.h
@@ -23,16 +23,6 @@  struct xfs_icluster {
 					 * sparse chunks */
 };
 
-/* Calculate and return the number of filesystem blocks per inode cluster */
-static inline int
-xfs_icluster_size_fsb(
-	struct xfs_mount	*mp)
-{
-	if (mp->m_sb.sb_blocksize >= M_IGEO(mp)->inode_cluster_size)
-		return 1;
-	return M_IGEO(mp)->inode_cluster_size >> mp->m_sb.sb_blocklog;
-}
-
 /*
  * Make an inode pointer out of the buffer/offset.
  */
@@ -160,7 +150,6 @@  int xfs_inobt_insert_rec(struct xfs_btree_cur *cur, uint16_t holemask,
 		uint8_t count, int32_t freecount, xfs_inofree_t free,
 		int *stat);
 
-int xfs_ialloc_cluster_alignment(struct xfs_mount *mp);
 void xfs_ialloc_setup_geometry(struct xfs_mount *mp);
 
 #endif	/* __XFS_IALLOC_H__ */