xfs: fix maxlevels comparisons in the btree staging code
authorDarrick J. Wong <djwong@kernel.org>
Thu, 16 Sep 2021 19:26:46 +0000 (12:26 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 14 Oct 2021 16:19:31 +0000 (09:19 -0700)
commit78e8ec83a404d63dcc86b251f42e4ee8aff27465
tree51ea0f020e4ed0705ab961ebc494a93bcb372ce2
parent512edfac85d243ed6a5a5f42f513ebb7c2d32863
xfs: fix maxlevels comparisons in the btree staging code

The btree geometry computation function has an off-by-one error in that
it does not allow maximally tall btrees (nlevels == XFS_BTREE_MAXLEVELS).
This can result in repairs failing unnecessarily on very fragmented
filesystems.  Subsequent patches to remove MAXLEVELS usage in favor of
the per-btree type computations will make this a much more likely
occurrence.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_btree_staging.c