xfs: fix computation of inode btree maxlevels
PATCH 1/1 xfs: fix computation of inode btree maxlevels
Commit 88740da18[1] introduced a function to compute the maximum height of the inode btree back in 1994. Back then, apparently, the freespace and inode btrees shared the same geometry; however, it has long since been the case that the inode and freespace btrees have different record and key sizes. Therefore, we must use m_inobt_mnr if we want a correct calculation/log reservation/etc.
(Yes, this bug has been around for 21 years and ten months.)
(Yes, I was in middle school when this bug was committed. 8-) )
--- fs/xfs/libxfs/xfs_ialloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/xfs/libxfs/xfs_ialloc.c +2 -2
@@ -2403,8 +2403,8 @@ xfs_ialloc_compute_maxlevels( maxleafents = (1LL <<XFS_INO_AGINO_BITS (mp)) >>XFS_INODES_PER_CHUNK_LOG ; - minleafrecs = mp->m_alloc_mnr[0 ]; - minnoderecs = mp->m_alloc_mnr[1 ]; + minleafrecs = mp->m_inobt_mnr[0 ]; + minnoderecs = mp->m_inobt_mnr[1 ]; maxblocks = (maxleafents + minleafrecs -1 ) / minleafrecs;for (level =1 ; maxblocks >1 ; level++) maxblocks = (maxblocks + minnoderecs -1 ) / minnoderecs;
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Darrick J. Wong
Commit 88740da18[1] introduced a function to compute the maximum height of the inode btree back in 1994. Back then, apparently, the freespace and inode btrees shared the same geometry; however, it has long since been the case that the inode and freespace btrees have different record and key sizes.
I think that's always been the case, so this has been buggy since day one. Congrat for gfinding one of the probably oldest bugs so far!
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs