Commit 309161f6 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: inode allocation can use a single perag instance

Now that we've internalised the two-phase inode allocation, we can
now easily make the AG selection and allocation atomic from the
perspective of a single perag context. This will ensure AGs going
offline/away cannot occur between the selection and allocation
steps.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent b652afd9
......@@ -1432,6 +1432,7 @@ static int
xfs_dialloc_ag(
struct xfs_trans *tp,
struct xfs_buf *agbp,
struct xfs_perag *pag,
xfs_ino_t parent,
xfs_ino_t *inop)
{
......@@ -1446,7 +1447,6 @@ xfs_dialloc_ag(
int error;
int offset;
int i;
struct xfs_perag *pag = agbp->b_pag;
if (!xfs_sb_version_hasfinobt(&mp->m_sb))
return xfs_dialloc_ag_inobt(tp, agbp, pag, parent, inop);
......@@ -1763,9 +1763,9 @@ xfs_dialloc(
xfs_perag_put(pag);
return error ? error : -ENOSPC;
found_ag:
xfs_perag_put(pag);
/* Allocate an inode in the found AG */
error = xfs_dialloc_ag(*tpp, agbp, parent, &ino);
error = xfs_dialloc_ag(*tpp, agbp, pag, parent, &ino);
xfs_perag_put(pag);
if (error)
return error;
*new_ino = ino;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment