xfs: pass transaction lock while setting up agresv on cyclic metadata
[linux-2.6-block.git] / fs / xfs / libxfs / xfs_rmap_btree.c
index 221a88ea60bb47afcf32005b9902168208d5047b..f79cf040d7450fe0c61a3f27bedbe89f4660d5cb 100644 (file)
@@ -554,6 +554,7 @@ xfs_rmapbt_max_size(
 int
 xfs_rmapbt_calc_reserves(
        struct xfs_mount        *mp,
+       struct xfs_trans        *tp,
        xfs_agnumber_t          agno,
        xfs_extlen_t            *ask,
        xfs_extlen_t            *used)
@@ -567,14 +568,14 @@ xfs_rmapbt_calc_reserves(
        if (!xfs_sb_version_hasrmapbt(&mp->m_sb))
                return 0;
 
-       error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
+       error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
        if (error)
                return error;
 
        agf = XFS_BUF_TO_AGF(agbp);
        agblocks = be32_to_cpu(agf->agf_length);
        tree_len = be32_to_cpu(agf->agf_rmap_blocks);
-       xfs_buf_relse(agbp);
+       xfs_trans_brelse(tp, agbp);
 
        /* Reserve 1% of the AG or enough for 1 block per record. */
        *ask += max(agblocks / 100, xfs_rmapbt_max_size(mp, agblocks));