xfs: fix maxlevels comparisons in the btree staging code
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Jul 2022 21:36:05 +0000 (14:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:08 +0000 (17:25 +0200)
commit67cb74213a5216c4452a78a0dfbb5a3724c1b706
tree6119c505f07ecf648ca68630253d38e2d2d19bac
parentcf719adb6fa91d49ef6009d1fab624dc0830ebcd
xfs: fix maxlevels comparisons in the btree staging code

[ Upstream commit 78e8ec83a404d63dcc86b251f42e4ee8aff27465 ]

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>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_btree_staging.c