return error;
 }
 
-/* Clean up after calling xfs_refcount_finish_one. */
-void
-xfs_refcount_finish_one_cleanup(
-       struct xfs_trans        *tp,
-       struct xfs_btree_cur    *rcur,
-       int                     error)
-{
-       struct xfs_buf          *agbp;
-
-       if (rcur == NULL)
-               return;
-       agbp = rcur->bc_ag.agbp;
-       xfs_btree_del_cursor(rcur, error);
-       if (error)
-               xfs_trans_brelse(tp, agbp);
-}
-
 /*
  * Set up a continuation a deferred refcount operation by updating the intent.
  * Checks to make sure we're not going to run off the end of the AG.
        if (rcur != NULL && rcur->bc_ag.pag != ri->ri_pag) {
                nr_ops = rcur->bc_refc.nr_ops;
                shape_changes = rcur->bc_refc.shape_changes;
-               xfs_refcount_finish_one_cleanup(tp, rcur, 0);
+               xfs_btree_del_cursor(rcur, 0);
                rcur = NULL;
                *pcur = NULL;
        }
 
 void xfs_refcount_decrease_extent(struct xfs_trans *tp,
                struct xfs_bmbt_irec *irec);
 
-extern void xfs_refcount_finish_one_cleanup(struct xfs_trans *tp,
-               struct xfs_btree_cur *rcur, int error);
 extern int xfs_refcount_finish_one(struct xfs_trans *tp,
                struct xfs_refcount_intent *ri, struct xfs_btree_cur **pcur);
 
 
 #include "xfs_log_priv.h"
 #include "xfs_log_recover.h"
 #include "xfs_ag.h"
+#include "xfs_btree.h"
 
 struct kmem_cache      *xfs_cui_cache;
 struct kmem_cache      *xfs_cud_cache;
        return error;
 }
 
+/* Clean up after calling xfs_refcount_finish_one. */
+STATIC void
+xfs_refcount_finish_one_cleanup(
+       struct xfs_trans        *tp,
+       struct xfs_btree_cur    *rcur,
+       int                     error)
+{
+       struct xfs_buf          *agbp;
+
+       if (rcur == NULL)
+               return;
+       agbp = rcur->bc_ag.agbp;
+       xfs_btree_del_cursor(rcur, error);
+       if (error)
+               xfs_trans_brelse(tp, agbp);
+}
+
 /* Abort all pending CUIs. */
 STATIC void
 xfs_refcount_update_abort_intent(