aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_trans_resv.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-06-05 11:19:35 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2019-06-12 08:37:40 -0700
commit490d451fa5188975c21246f7f8f4914cd3f2d6f2 (patch)
tree334d0a26f447c2e594aa18fe5336487e4801bf9e /fs/xfs/libxfs/xfs_trans_resv.c
parentxfs: refactor inode geometry setup routines (diff)
downloadlinux-stable-490d451fa5188975c21246f7f8f4914cd3f2d6f2.tar.xz
linux-stable-490d451fa5188975c21246f7f8f4914cd3f2d6f2.zip
xfs: fix inode_cluster_size rounding mayhem
inode_cluster_size is supposed to represent the size (in bytes) of an inode cluster buffer. We avoid having to handle multiple clusters per filesystem block on filesystems with large blocks by openly rounding this value up to 1 FSB when necessary. However, we never reset inode_cluster_size to reflect this new rounded value, which adds to the potential for mistakes in calculating geometries. Fix this by setting inode_cluster_size to reflect the rounded-up size if needed, and special-case the few places in the sparse inodes code where we actually need the smaller value to validate on-disk metadata. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_trans_resv.c')
-rw-r--r--fs/xfs/libxfs/xfs_trans_resv.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_trans_resv.c b/fs/xfs/libxfs/xfs_trans_resv.c
index 2663dd7975a5..9d1326d14af9 100644
--- a/fs/xfs/libxfs/xfs_trans_resv.c
+++ b/fs/xfs/libxfs/xfs_trans_resv.c
@@ -308,8 +308,7 @@ xfs_calc_iunlink_remove_reservation(
struct xfs_mount *mp)
{
return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
- 2 * max_t(uint, XFS_FSB_TO_B(mp, 1),
- M_IGEO(mp)->inode_cluster_size);
+ 2 * M_IGEO(mp)->inode_cluster_size;
}
/*
@@ -347,8 +346,7 @@ STATIC uint
xfs_calc_iunlink_add_reservation(xfs_mount_t *mp)
{
return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
- max_t(uint, XFS_FSB_TO_B(mp, 1),
- M_IGEO(mp)->inode_cluster_size);
+ M_IGEO(mp)->inode_cluster_size;
}
/*