Commit f40aadb2 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: use perag through unlink processing

Unlinked lists are held in the perag, and freeing of inodes needs to
be passed a perag, too, so look up the perag early in the unlink
processing and use it throughout.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
parent 8237fbf5
...@@ -2134,35 +2134,33 @@ xfs_difree_finobt( ...@@ -2134,35 +2134,33 @@ xfs_difree_finobt(
*/ */
int int
xfs_difree( xfs_difree(
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp,
xfs_ino_t inode, /* inode to be freed */ struct xfs_perag *pag,
struct xfs_icluster *xic) /* cluster info if deleted */ xfs_ino_t inode,
struct xfs_icluster *xic)
{ {
/* REFERENCED */ /* REFERENCED */
xfs_agblock_t agbno; /* block number containing inode */ xfs_agblock_t agbno; /* block number containing inode */
struct xfs_buf *agbp; /* buffer for allocation group header */ struct xfs_buf *agbp; /* buffer for allocation group header */
xfs_agino_t agino; /* allocation group inode number */ xfs_agino_t agino; /* allocation group inode number */
xfs_agnumber_t agno; /* allocation group number */
int error; /* error return value */ int error; /* error return value */
struct xfs_mount *mp = tp->t_mountp; struct xfs_mount *mp = tp->t_mountp;
struct xfs_inobt_rec_incore rec;/* btree record */ struct xfs_inobt_rec_incore rec;/* btree record */
struct xfs_perag *pag;
/* /*
* Break up inode number into its components. * Break up inode number into its components.
*/ */
agno = XFS_INO_TO_AGNO(mp, inode); if (pag->pag_agno != XFS_INO_TO_AGNO(mp, inode)) {
if (agno >= mp->m_sb.sb_agcount) { xfs_warn(mp, "%s: agno != pag->pag_agno (%d != %d).",
xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).", __func__, XFS_INO_TO_AGNO(mp, inode), pag->pag_agno);
__func__, agno, mp->m_sb.sb_agcount);
ASSERT(0); ASSERT(0);
return -EINVAL; return -EINVAL;
} }
agino = XFS_INO_TO_AGINO(mp, inode); agino = XFS_INO_TO_AGINO(mp, inode);
if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) { if (inode != XFS_AGINO_TO_INO(mp, pag->pag_agno, agino)) {
xfs_warn(mp, "%s: inode != XFS_AGINO_TO_INO() (%llu != %llu).", xfs_warn(mp, "%s: inode != XFS_AGINO_TO_INO() (%llu != %llu).",
__func__, (unsigned long long)inode, __func__, (unsigned long long)inode,
(unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino)); (unsigned long long)XFS_AGINO_TO_INO(mp, pag->pag_agno, agino));
ASSERT(0); ASSERT(0);
return -EINVAL; return -EINVAL;
} }
...@@ -2176,7 +2174,7 @@ xfs_difree( ...@@ -2176,7 +2174,7 @@ xfs_difree(
/* /*
* Get the allocation group header. * Get the allocation group header.
*/ */
error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); error = xfs_ialloc_read_agi(mp, tp, pag->pag_agno, &agbp);
if (error) { if (error) {
xfs_warn(mp, "%s: xfs_ialloc_read_agi() returned error %d.", xfs_warn(mp, "%s: xfs_ialloc_read_agi() returned error %d.",
__func__, error); __func__, error);
...@@ -2186,7 +2184,6 @@ xfs_difree( ...@@ -2186,7 +2184,6 @@ xfs_difree(
/* /*
* Fix up the inode allocation btree. * Fix up the inode allocation btree.
*/ */
pag = agbp->b_pag;
error = xfs_difree_inobt(mp, tp, agbp, pag, agino, xic, &rec); error = xfs_difree_inobt(mp, tp, agbp, pag, agino, xic, &rec);
if (error) if (error)
goto error0; goto error0;
......
...@@ -39,17 +39,8 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o) ...@@ -39,17 +39,8 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
int xfs_dialloc(struct xfs_trans **tpp, xfs_ino_t parent, umode_t mode, int xfs_dialloc(struct xfs_trans **tpp, xfs_ino_t parent, umode_t mode,
xfs_ino_t *new_ino); xfs_ino_t *new_ino);
/* int xfs_difree(struct xfs_trans *tp, struct xfs_perag *pag,
* Free disk inode. Carefully avoids touching the incore inode, all xfs_ino_t ino, struct xfs_icluster *ifree);
* manipulations incore are the caller's responsibility.
* The on-disk inode is not changed by this operation, only the
* btree (free inode mask) is changed.
*/
int /* error */
xfs_difree(
struct xfs_trans *tp, /* transaction pointer */
xfs_ino_t inode, /* inode to be freed */
struct xfs_icluster *ifree); /* cluster info if deleted */
/* /*
* Return the location of the inode in imap, for mapping it into a buffer. * Return the location of the inode in imap, for mapping it into a buffer.
......
This diff is collapsed.
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