if (irec->rc_blockcount == 0 || irec->rc_blockcount > MAXREFCEXTLEN)
                goto out_bad_rec;
 
-       /* handle special COW-staging domain */
-       if (irec->rc_domain == XFS_REFC_DOMAIN_COW && irec->rc_refcount != 1)
-               goto out_bad_rec;
-       if (irec->rc_domain == XFS_REFC_DOMAIN_SHARED && irec->rc_refcount < 2)
+       if (!xfs_refcount_check_domain(irec))
                goto out_bad_rec;
 
        /* check for valid extent range, including overflow */
 
        xfs_fsblock_t                           ri_startblock;
 };
 
+/* Check that the refcount is appropriate for the record domain. */
+static inline bool
+xfs_refcount_check_domain(
+       const struct xfs_refcount_irec  *irec)
+{
+       if (irec->rc_domain == XFS_REFC_DOMAIN_COW && irec->rc_refcount != 1)
+               return false;
+       if (irec->rc_domain == XFS_REFC_DOMAIN_SHARED && irec->rc_refcount < 2)
+               return false;
+       return true;
+}
+
 void xfs_refcount_increase_extent(struct xfs_trans *tp,
                struct xfs_bmbt_irec *irec);
 void xfs_refcount_decrease_extent(struct xfs_trans *tp,
 
 
        xfs_refcount_btrec_to_irec(rec, &irec);
 
-       /* Only CoW records can have refcount == 1. */
-       if (irec.rc_domain == XFS_REFC_DOMAIN_SHARED && irec.rc_refcount == 1)
+       /* Check the domain and refcount are not incompatible. */
+       if (!xfs_refcount_check_domain(&irec))
                xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
-       if (irec.rc_domain == XFS_REFC_DOMAIN_COW) {
-               if (irec.rc_refcount != 1)
-                       xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
+
+       if (irec.rc_domain == XFS_REFC_DOMAIN_COW)
                (*cow_blocks) += irec.rc_blockcount;
-       }
 
        /* Check the extent. */
        if (!xfs_verify_agbext(pag, irec.rc_startblock, irec.rc_blockcount))