mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
xfs: refactor btree maxlevels computation
Create a common function to calculate the maximum height of a per-AG btree. This will eventually be used by the rmapbt and refcountbt code to calculate appropriate maxlevels values for each. This is important because the verifiers and the transaction block reservations depend on accurate estimates of how many blocks are needed to satisfy a btree split. We were mistakenly using the max bnobt height for all the btrees, which creates a dangerous situation since the larger records and keys in an rmapbt make it very possible that the rmapbt will be taller than the bnobt and so we can run out of transaction block reservation. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
e66a4c678e
commit
19b54ee66c
4 changed files with 27 additions and 26 deletions
|
@ -2394,20 +2394,11 @@ void
|
|||
xfs_ialloc_compute_maxlevels(
|
||||
xfs_mount_t *mp) /* file system mount structure */
|
||||
{
|
||||
int level;
|
||||
uint maxblocks;
|
||||
uint maxleafents;
|
||||
int minleafrecs;
|
||||
int minnoderecs;
|
||||
uint inodes;
|
||||
|
||||
maxleafents = (1LL << XFS_INO_AGINO_BITS(mp)) >>
|
||||
XFS_INODES_PER_CHUNK_LOG;
|
||||
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;
|
||||
mp->m_in_maxlevels = level;
|
||||
inodes = (1LL << XFS_INO_AGINO_BITS(mp)) >> XFS_INODES_PER_CHUNK_LOG;
|
||||
mp->m_in_maxlevels = xfs_btree_compute_maxlevels(mp, mp->m_inobt_mnr,
|
||||
inodes);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue