mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
xfs: replace xfs_ag_block_count() with perag accesses
Many of the places that call xfs_ag_block_count() have a perag available. These places can just read pag->block_count directly instead of calculating the AG block count from first principles. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
parent
2d6ca8321c
commit
3829c9a10f
3 changed files with 11 additions and 13 deletions
|
@ -683,10 +683,10 @@ xfs_inobt_rec_check_count(
|
|||
|
||||
static xfs_extlen_t
|
||||
xfs_inobt_max_size(
|
||||
struct xfs_mount *mp,
|
||||
xfs_agnumber_t agno)
|
||||
struct xfs_perag *pag)
|
||||
{
|
||||
xfs_agblock_t agblocks = xfs_ag_block_count(mp, agno);
|
||||
struct xfs_mount *mp = pag->pag_mount;
|
||||
xfs_agblock_t agblocks = pag->block_count;
|
||||
|
||||
/* Bail out if we're uninitialized, which can happen in mkfs. */
|
||||
if (M_IGEO(mp)->inobt_mxr[0] == 0)
|
||||
|
@ -698,7 +698,7 @@ xfs_inobt_max_size(
|
|||
* expansion. We therefore can pretend the space isn't there.
|
||||
*/
|
||||
if (mp->m_sb.sb_logstart &&
|
||||
XFS_FSB_TO_AGNO(mp, mp->m_sb.sb_logstart) == agno)
|
||||
XFS_FSB_TO_AGNO(mp, mp->m_sb.sb_logstart) == pag->pag_agno)
|
||||
agblocks -= mp->m_sb.sb_logblocks;
|
||||
|
||||
return xfs_btree_calc_size(M_IGEO(mp)->inobt_mnr,
|
||||
|
@ -800,7 +800,7 @@ xfs_finobt_calc_reserves(
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
*ask += xfs_inobt_max_size(mp, pag->pag_agno);
|
||||
*ask += xfs_inobt_max_size(pag);
|
||||
*used += tree_len;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -198,8 +198,7 @@ xrep_agf_init_header(
|
|||
agf->agf_magicnum = cpu_to_be32(XFS_AGF_MAGIC);
|
||||
agf->agf_versionnum = cpu_to_be32(XFS_AGF_VERSION);
|
||||
agf->agf_seqno = cpu_to_be32(sc->sa.pag->pag_agno);
|
||||
agf->agf_length = cpu_to_be32(xfs_ag_block_count(mp,
|
||||
sc->sa.pag->pag_agno));
|
||||
agf->agf_length = cpu_to_be32(sc->sa.pag->block_count);
|
||||
agf->agf_flfirst = old_agf->agf_flfirst;
|
||||
agf->agf_fllast = old_agf->agf_fllast;
|
||||
agf->agf_flcount = old_agf->agf_flcount;
|
||||
|
@ -777,8 +776,7 @@ xrep_agi_init_header(
|
|||
agi->agi_magicnum = cpu_to_be32(XFS_AGI_MAGIC);
|
||||
agi->agi_versionnum = cpu_to_be32(XFS_AGI_VERSION);
|
||||
agi->agi_seqno = cpu_to_be32(sc->sa.pag->pag_agno);
|
||||
agi->agi_length = cpu_to_be32(xfs_ag_block_count(mp,
|
||||
sc->sa.pag->pag_agno));
|
||||
agi->agi_length = cpu_to_be32(sc->sa.pag->block_count);
|
||||
agi->agi_newino = cpu_to_be32(NULLAGINO);
|
||||
agi->agi_dirino = cpu_to_be32(NULLAGINO);
|
||||
if (xfs_has_crc(mp))
|
||||
|
|
|
@ -209,7 +209,7 @@ xrep_calc_ag_resblks(
|
|||
/* Now grab the block counters from the AGF. */
|
||||
error = xfs_alloc_read_agf(pag, NULL, 0, &bp);
|
||||
if (error) {
|
||||
aglen = xfs_ag_block_count(mp, sm->sm_agno);
|
||||
aglen = pag->block_count;
|
||||
freelen = aglen;
|
||||
usedlen = aglen;
|
||||
} else {
|
||||
|
@ -226,16 +226,16 @@ xrep_calc_ag_resblks(
|
|||
!xfs_verify_agino(pag, icount)) {
|
||||
icount = pag->agino_max - pag->agino_min + 1;
|
||||
}
|
||||
xfs_perag_put(pag);
|
||||
|
||||
/* If the block counts are impossible, make worst-case assumptions. */
|
||||
if (aglen == NULLAGBLOCK ||
|
||||
aglen != xfs_ag_block_count(mp, sm->sm_agno) ||
|
||||
aglen != pag->block_count ||
|
||||
freelen >= aglen) {
|
||||
aglen = xfs_ag_block_count(mp, sm->sm_agno);
|
||||
aglen = pag->block_count;
|
||||
freelen = aglen;
|
||||
usedlen = aglen;
|
||||
}
|
||||
xfs_perag_put(pag);
|
||||
|
||||
trace_xrep_calc_ag_resblks(mp, sm->sm_agno, icount, aglen,
|
||||
freelen, usedlen);
|
||||
|
|
Loading…
Add table
Reference in a new issue