int                     level,
        void                    *data)
 {
-       xfs_extlen_t            *blocks = data;
+       xfs_filblks_t           *blocks = data;
        (*blocks)++;
 
        return 0;
 int
 xfs_btree_count_blocks(
        struct xfs_btree_cur    *cur,
-       xfs_extlen_t            *blocks)
+       xfs_filblks_t           *blocks)
 {
        *blocks = 0;
        return xfs_btree_visit_blocks(cur, xfs_btree_count_blocks_helper,
 
 int xfs_btree_visit_blocks(struct xfs_btree_cur *cur,
                xfs_btree_visit_blocks_fn fn, unsigned int flags, void *data);
 
-int xfs_btree_count_blocks(struct xfs_btree_cur *cur, xfs_extlen_t *blocks);
+int xfs_btree_count_blocks(struct xfs_btree_cur *cur, xfs_filblks_t *blocks);
 
 union xfs_btree_rec *xfs_btree_rec_addr(struct xfs_btree_cur *cur, int n,
                struct xfs_btree_block *block);
 
 {
        struct xfs_buf          *agbp = NULL;
        struct xfs_btree_cur    *cur;
+       xfs_filblks_t           blocks;
        int                     error;
 
        error = xfs_ialloc_read_agi(pag, tp, 0, &agbp);
                return error;
 
        cur = xfs_finobt_init_cursor(pag, tp, agbp);
-       error = xfs_btree_count_blocks(cur, tree_blocks);
+       error = xfs_btree_count_blocks(cur, &blocks);
        xfs_btree_del_cursor(cur, error);
        xfs_trans_brelse(tp, agbp);
+       *tree_blocks = blocks;
 
        return error;
 }
 
 {
        struct xfs_agf          *agf = sc->sa.agf_bp->b_addr;
        struct xfs_mount        *mp = sc->mp;
-       xfs_agblock_t           blocks;
+       xfs_filblks_t           blocks;
        xfs_agblock_t           btreeblks;
        int                     error;
 
        struct xfs_scrub        *sc)
 {
        struct xfs_agf          *agf = sc->sa.agf_bp->b_addr;
-       xfs_agblock_t           blocks;
+       xfs_filblks_t           blocks;
        int                     error;
 
        if (!sc->sa.refc_cur)
        struct xfs_scrub        *sc)
 {
        struct xfs_agi          *agi = sc->sa.agi_bp->b_addr;
-       xfs_agblock_t           blocks;
+       xfs_filblks_t           blocks;
        int                     error = 0;
 
        if (!xfs_has_inobtcounts(sc->mp))
 
        struct xfs_agf          *agf = agf_bp->b_addr;
        struct xfs_mount        *mp = sc->mp;
        xfs_agblock_t           btreeblks;
-       xfs_agblock_t           blocks;
+       xfs_filblks_t           blocks;
        int                     error;
 
        /* Update the AGF counters from the bnobt. */
        if (error)
                goto err;
        if (xfs_has_inobtcounts(mp)) {
-               xfs_agblock_t   blocks;
+               xfs_filblks_t   blocks;
 
                error = xfs_btree_count_blocks(cur, &blocks);
                if (error)
        agi->agi_freecount = cpu_to_be32(freecount);
 
        if (xfs_has_finobt(mp) && xfs_has_inobtcounts(mp)) {
-               xfs_agblock_t   blocks;
+               xfs_filblks_t   blocks;
 
                cur = xfs_finobt_init_cursor(sc->sa.pag, sc->tp, agi_bp);
                error = xfs_btree_count_blocks(cur, &blocks);
 
        struct xchk_fscounters  *fsc,
        xfs_agnumber_t          agno)
 {
-       xfs_extlen_t            blocks;
+       xfs_filblks_t           blocks;
        int                     error;
 
        error = xchk_ag_init_existing(sc, agno, &sc->sa);
 
        struct xfs_scrub        *sc)
 {
        xfs_filblks_t           blocks;
-       xfs_extlen_t            inobt_blocks = 0;
-       xfs_extlen_t            finobt_blocks = 0;
+       xfs_filblks_t           inobt_blocks = 0;
+       xfs_filblks_t           finobt_blocks = 0;
        int                     error;
 
        if (!sc->sa.ino_cur || !sc->sa.rmap_cur ||
 
        struct xfs_scrub        *sc,
        xfs_filblks_t           cow_blocks)
 {
-       xfs_extlen_t            refcbt_blocks = 0;
+       xfs_filblks_t           refcbt_blocks = 0;
        xfs_filblks_t           blocks;
        int                     error;
 
 
        struct xfs_mount        *mp = ip->i_mount;
        struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_btree_cur    *cur;
-       xfs_extlen_t            btblocks = 0;
+       xfs_filblks_t           btblocks = 0;
        int                     error;
 
        *nextents = 0;