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

xfs: kill xfs_ialloc_pagi_init()

This is just a basic wrapper around xfs_ialloc_read_agi(), which can
be entirely handled by xfs_ialloc_read_agi() by passing a NULL
agibpp....
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent c6aee248
...@@ -128,9 +128,10 @@ xfs_initialize_perag_data( ...@@ -128,9 +128,10 @@ xfs_initialize_perag_data(
if (error) if (error)
return error; return error;
error = xfs_ialloc_pagi_init(mp, NULL, index); error = xfs_ialloc_read_agi(mp, NULL, index, NULL);
if (error) if (error)
return error; return error;
pag = xfs_perag_get(mp, index); pag = xfs_perag_get(mp, index);
ifree += pag->pagi_freecount; ifree += pag->pagi_freecount;
ialloc += pag->pagi_count; ialloc += pag->pagi_count;
......
...@@ -1610,7 +1610,7 @@ xfs_dialloc_good_ag( ...@@ -1610,7 +1610,7 @@ xfs_dialloc_good_ag(
return false; return false;
if (!pag->pagi_init) { if (!pag->pagi_init) {
error = xfs_ialloc_pagi_init(mp, tp, pag->pag_agno); error = xfs_ialloc_read_agi(mp, tp, pag->pag_agno, NULL);
if (error) if (error)
return false; return false;
} }
...@@ -2593,25 +2593,30 @@ xfs_read_agi( ...@@ -2593,25 +2593,30 @@ xfs_read_agi(
return 0; return 0;
} }
/*
* Read in the agi and initialise the per-ag data. If the caller supplies a
* @agibpp, return the locked AGI buffer to them, otherwise release it.
*/
int int
xfs_ialloc_read_agi( xfs_ialloc_read_agi(
struct xfs_mount *mp, /* file system mount structure */ struct xfs_mount *mp, /* file system mount structure */
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_agnumber_t agno, /* allocation group number */ xfs_agnumber_t agno, /* allocation group number */
struct xfs_buf **bpp) /* allocation group hdr buf */ struct xfs_buf **agibpp)
{ {
struct xfs_buf *agibp;
struct xfs_agi *agi; /* allocation group header */ struct xfs_agi *agi; /* allocation group header */
struct xfs_perag *pag; /* per allocation group data */ struct xfs_perag *pag; /* per allocation group data */
int error; int error;
trace_xfs_ialloc_read_agi(mp, agno); trace_xfs_ialloc_read_agi(mp, agno);
error = xfs_read_agi(mp, tp, agno, bpp); error = xfs_read_agi(mp, tp, agno, &agibp);
if (error) if (error)
return error; return error;
agi = (*bpp)->b_addr; agi = agibp->b_addr;
pag = (*bpp)->b_pag; pag = agibp->b_pag;
if (!pag->pagi_init) { if (!pag->pagi_init) {
pag->pagi_freecount = be32_to_cpu(agi->agi_freecount); pag->pagi_freecount = be32_to_cpu(agi->agi_freecount);
pag->pagi_count = be32_to_cpu(agi->agi_count); pag->pagi_count = be32_to_cpu(agi->agi_count);
...@@ -2624,26 +2629,10 @@ xfs_ialloc_read_agi( ...@@ -2624,26 +2629,10 @@ xfs_ialloc_read_agi(
*/ */
ASSERT(pag->pagi_freecount == be32_to_cpu(agi->agi_freecount) || ASSERT(pag->pagi_freecount == be32_to_cpu(agi->agi_freecount) ||
xfs_is_shutdown(mp)); xfs_is_shutdown(mp));
return 0; if (agibpp)
} *agibpp = agibp;
else
/* xfs_trans_brelse(tp, agibp);
* Read in the agi to initialise the per-ag data in the mount structure
*/
int
xfs_ialloc_pagi_init(
xfs_mount_t *mp, /* file system mount structure */
xfs_trans_t *tp, /* transaction pointer */
xfs_agnumber_t agno) /* allocation group number */
{
struct xfs_buf *bp = NULL;
int error;
error = xfs_ialloc_read_agi(mp, tp, agno, &bp);
if (error)
return error;
if (bp)
xfs_trans_brelse(tp, bp);
return 0; return 0;
} }
......
...@@ -72,16 +72,6 @@ xfs_ialloc_read_agi( ...@@ -72,16 +72,6 @@ xfs_ialloc_read_agi(
xfs_agnumber_t agno, /* allocation group number */ xfs_agnumber_t agno, /* allocation group number */
struct xfs_buf **bpp); /* allocation group hdr buf */ struct xfs_buf **bpp); /* allocation group hdr buf */
/*
* Read in the allocation group header to initialise the per-ag data
* in the mount structure
*/
int
xfs_ialloc_pagi_init(
struct xfs_mount *mp, /* file system mount structure */
struct xfs_trans *tp, /* transaction pointer */
xfs_agnumber_t agno); /* allocation group number */
/* /*
* Lookup a record by ino in the btree given by cur. * Lookup a record by ino in the btree given by cur.
*/ */
......
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