xfs: Use xfs_icluster_size_fsb() to calculate inode alignment mask
authorChandan Rajendra <chandan@linux.vnet.ibm.com>
Thu, 2 Mar 2017 23:06:33 +0000 (15:06 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 8 Mar 2017 04:10:50 +0000 (20:10 -0800)
commitd5825712ee98d68a2c17bc89dad2c30276894cba
treec1cf536ea150302584ba88f8b6fa8aa76585770c
parent787eb485509f9d58962bd8b4dbc6a5ac6e2034fe
xfs: Use xfs_icluster_size_fsb() to calculate inode alignment mask

When block size is larger than inode cluster size, the call to
XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size) returns 0. Also, mkfs.xfs
would have set xfs_sb->sb_inoalignmt to 0. Hence in
xfs_set_inoalignment(), xfs_mount->m_inoalign_mask gets initialized to
-1 instead of 0. However, xfs_mount->m_sinoalign would get correctly
intialized to 0 because for every positive value of xfs_mount->m_dalign,
the condition "!(mp->m_dalign & mp->m_inoalign_mask)" would evaluate to
false.

Also, xfs_imap() worked fine even with xfs_mount->m_inoalign_mask having
-1 as the value because blks_per_cluster variable would have the value 1
and hence we would never have a need to use xfs_mount->m_inoalign_mask
to compute the inode chunk's agbno and offset within the chunk.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_mount.c