aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_alloc.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-03-09 17:01:59 -0500
committerDarrick J. Wong <darrick.wong@oracle.com>2018-03-11 23:27:57 -0400
commit215928633502a7296fec42614463bb49859787d6 (patch)
tree1a64d31e4753bee8954a507593393626654f56f5 /fs/xfs/libxfs/xfs_alloc.c
parentb3fed434822d0873269231f77e23fc801da32569 (diff)
xfs: rename agfl perag res type to rmapbt
The AGFL perag reservation type accounts all allocations that feed into (or are released from) the allocation group free list (agfl). The purpose of the reservation is to support worst case conditions for the reverse mapping btree (rmapbt). As such, the agfl reservation usage accounting only considers rmapbt usage when the in-core counters are initialized at mount time. This implementation inconsistency leads to divergence of the in-core and on-disk usage accounting over time. In preparation to resolve this inconsistency and adjust the AGFL reservation into an rmapbt specific reservation, rename the AGFL reservation type and associated accounting fields to something more rmapbt-specific. Also fix up a couple tracepoints that incorrectly use the AGFL reservation type to pass the agfl state of the associated extent where the raw reservation type is expected. Note that this patch does not change perag reservation behavior. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_alloc.c')
-rw-r--r--fs/xfs/libxfs/xfs_alloc.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index 36101e55ed07..1dc244d15a75 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -728,7 +728,7 @@ xfs_alloc_ag_vextent(
728 728
729 ASSERT(args->len >= args->minlen); 729 ASSERT(args->len >= args->minlen);
730 ASSERT(args->len <= args->maxlen); 730 ASSERT(args->len <= args->maxlen);
731 ASSERT(!args->wasfromfl || args->resv != XFS_AG_RESV_AGFL); 731 ASSERT(!args->wasfromfl || args->resv != XFS_AG_RESV_RMAPBT);
732 ASSERT(args->agbno % args->alignment == 0); 732 ASSERT(args->agbno % args->alignment == 0);
733 733
734 /* if not file data, insert new block into the reverse map btree */ 734 /* if not file data, insert new block into the reverse map btree */
@@ -1600,7 +1600,7 @@ xfs_alloc_ag_vextent_small(
1600 * freelist. 1600 * freelist.
1601 */ 1601 */
1602 else if (args->minlen == 1 && args->alignment == 1 && 1602 else if (args->minlen == 1 && args->alignment == 1 &&
1603 args->resv != XFS_AG_RESV_AGFL && 1603 args->resv != XFS_AG_RESV_RMAPBT &&
1604 (be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_flcount) 1604 (be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_flcount)
1605 > args->minleft)) { 1605 > args->minleft)) {
1606 error = xfs_alloc_get_freelist(args->tp, args->agbp, &fbno, 0); 1606 error = xfs_alloc_get_freelist(args->tp, args->agbp, &fbno, 0);
@@ -1634,7 +1634,7 @@ xfs_alloc_ag_vextent_small(
1634 * If we're feeding an AGFL block to something that 1634 * If we're feeding an AGFL block to something that
1635 * doesn't live in the free space, we need to clear 1635 * doesn't live in the free space, we need to clear
1636 * out the OWN_AG rmap and add the block back to 1636 * out the OWN_AG rmap and add the block back to
1637 * the AGFL per-AG reservation. 1637 * the RMAPBT per-AG reservation.
1638 */ 1638 */
1639 xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG); 1639 xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG);
1640 error = xfs_rmap_free(args->tp, args->agbp, args->agno, 1640 error = xfs_rmap_free(args->tp, args->agbp, args->agno,
@@ -1642,7 +1642,7 @@ xfs_alloc_ag_vextent_small(
1642 if (error) 1642 if (error)
1643 goto error0; 1643 goto error0;
1644 pag = xfs_perag_get(args->mp, args->agno); 1644 pag = xfs_perag_get(args->mp, args->agno);
1645 xfs_ag_resv_free_extent(pag, XFS_AG_RESV_AGFL, 1645 xfs_ag_resv_free_extent(pag, XFS_AG_RESV_RMAPBT,
1646 args->tp, 1); 1646 args->tp, 1);
1647 xfs_perag_put(pag); 1647 xfs_perag_put(pag);
1648 1648
@@ -1928,14 +1928,12 @@ xfs_free_ag_extent(
1928 XFS_STATS_INC(mp, xs_freex); 1928 XFS_STATS_INC(mp, xs_freex);
1929 XFS_STATS_ADD(mp, xs_freeb, len); 1929 XFS_STATS_ADD(mp, xs_freeb, len);
1930 1930
1931 trace_xfs_free_extent(mp, agno, bno, len, type == XFS_AG_RESV_AGFL, 1931 trace_xfs_free_extent(mp, agno, bno, len, type, haveleft, haveright);
1932 haveleft, haveright);
1933 1932
1934 return 0; 1933 return 0;
1935 1934
1936 error0: 1935 error0:
1937 trace_xfs_free_extent(mp, agno, bno, len, type == XFS_AG_RESV_AGFL, 1936 trace_xfs_free_extent(mp, agno, bno, len, type, -1, -1);
1938 -1, -1);
1939 if (bno_cur) 1937 if (bno_cur)
1940 xfs_btree_del_cursor(bno_cur, XFS_BTREE_ERROR); 1938 xfs_btree_del_cursor(bno_cur, XFS_BTREE_ERROR);
1941 if (cnt_cur) 1939 if (cnt_cur)
@@ -2172,7 +2170,7 @@ xfs_alloc_fix_freelist(
2172 if (error) 2170 if (error)
2173 goto out_agbp_relse; 2171 goto out_agbp_relse;
2174 error = xfs_free_ag_extent(tp, agbp, args->agno, bno, 1, 2172 error = xfs_free_ag_extent(tp, agbp, args->agno, bno, 1,
2175 &targs.oinfo, XFS_AG_RESV_AGFL); 2173 &targs.oinfo, XFS_AG_RESV_RMAPBT);
2176 if (error) 2174 if (error)
2177 goto out_agbp_relse; 2175 goto out_agbp_relse;
2178 bp = xfs_btree_get_bufs(mp, tp, args->agno, bno, 0); 2176 bp = xfs_btree_get_bufs(mp, tp, args->agno, bno, 0);
@@ -2198,7 +2196,7 @@ xfs_alloc_fix_freelist(
2198 while (pag->pagf_flcount < need) { 2196 while (pag->pagf_flcount < need) {
2199 targs.agbno = 0; 2197 targs.agbno = 0;
2200 targs.maxlen = need - pag->pagf_flcount; 2198 targs.maxlen = need - pag->pagf_flcount;
2201 targs.resv = XFS_AG_RESV_AGFL; 2199 targs.resv = XFS_AG_RESV_RMAPBT;
2202 2200
2203 /* Allocate as many blocks as possible at once. */ 2201 /* Allocate as many blocks as possible at once. */
2204 error = xfs_alloc_ag_vextent(&targs); 2202 error = xfs_alloc_ag_vextent(&targs);
@@ -2879,7 +2877,7 @@ xfs_free_extent(
2879 int error; 2877 int error;
2880 2878
2881 ASSERT(len != 0); 2879 ASSERT(len != 0);
2882 ASSERT(type != XFS_AG_RESV_AGFL); 2880 ASSERT(type != XFS_AG_RESV_RMAPBT);
2883 2881
2884 if (XFS_TEST_ERROR(false, mp, 2882 if (XFS_TEST_ERROR(false, mp,
2885 XFS_ERRTAG_FREE_EXTENT)) 2883 XFS_ERRTAG_FREE_EXTENT))