xfs: add a short cut to xfs_dialloc for the non-NULL agbp case
In this case we already have selected an AG and know it has free space beause the buffer lock never got released. Jump directly into xfs_dialloc_ag and short cut the AG selection loop. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
This commit is contained in:
parent
08358906ed
commit
4bb61069d2
1 changed files with 26 additions and 21 deletions
|
@ -634,6 +634,10 @@ xfs_dialloc_ag(
|
||||||
|
|
||||||
pag = xfs_perag_get(mp, agno);
|
pag = xfs_perag_get(mp, agno);
|
||||||
|
|
||||||
|
ASSERT(pag->pagi_init);
|
||||||
|
ASSERT(pag->pagi_inodeok);
|
||||||
|
ASSERT(pag->pagi_freecount > 0);
|
||||||
|
|
||||||
restart_pagno:
|
restart_pagno:
|
||||||
cur = xfs_inobt_init_cursor(mp, tp, agbp, agno);
|
cur = xfs_inobt_init_cursor(mp, tp, agbp, agno);
|
||||||
/*
|
/*
|
||||||
|
@ -907,32 +911,32 @@ xfs_dialloc(
|
||||||
xfs_agnumber_t tagno;
|
xfs_agnumber_t tagno;
|
||||||
struct xfs_perag *pag;
|
struct xfs_perag *pag;
|
||||||
|
|
||||||
if (*IO_agbp == NULL) {
|
if (*IO_agbp) {
|
||||||
/*
|
/*
|
||||||
* We do not have an agbp, so select an initial allocation
|
* If the caller passes in a pointer to the AGI buffer,
|
||||||
* group for inode allocation.
|
* continue where we left off before. In this case, we
|
||||||
*/
|
|
||||||
agbp = xfs_ialloc_ag_select(tp, parent, mode, okalloc);
|
|
||||||
/*
|
|
||||||
* Couldn't find an allocation group satisfying the
|
|
||||||
* criteria, give up.
|
|
||||||
*/
|
|
||||||
if (!agbp) {
|
|
||||||
*inop = NULLFSINO;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
agi = XFS_BUF_TO_AGI(agbp);
|
|
||||||
ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC));
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Continue where we left off before. In this case, we
|
|
||||||
* know that the allocation group has free inodes.
|
* know that the allocation group has free inodes.
|
||||||
*/
|
*/
|
||||||
agbp = *IO_agbp;
|
agbp = *IO_agbp;
|
||||||
agi = XFS_BUF_TO_AGI(agbp);
|
goto out_alloc;
|
||||||
ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC));
|
|
||||||
ASSERT(be32_to_cpu(agi->agi_freecount) > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We do not have an agbp, so select an initial allocation
|
||||||
|
* group for inode allocation.
|
||||||
|
*/
|
||||||
|
agbp = xfs_ialloc_ag_select(tp, parent, mode, okalloc);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Couldn't find an allocation group satisfying the
|
||||||
|
* criteria, give up.
|
||||||
|
*/
|
||||||
|
if (!agbp) {
|
||||||
|
*inop = NULLFSINO;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
agi = XFS_BUF_TO_AGI(agbp);
|
||||||
|
|
||||||
mp = tp->t_mountp;
|
mp = tp->t_mountp;
|
||||||
agno = be32_to_cpu(agi->agi_seqno);
|
agno = be32_to_cpu(agi->agi_seqno);
|
||||||
tagno = agno;
|
tagno = agno;
|
||||||
|
@ -1012,6 +1016,7 @@ nextag:
|
||||||
ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC));
|
ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out_alloc:
|
||||||
*IO_agbp = NULL;
|
*IO_agbp = NULL;
|
||||||
return xfs_dialloc_ag(tp, agbp, parent, inop);
|
return xfs_dialloc_ag(tp, agbp, parent, inop);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue