@@ -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
@@ -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__ */