+ error = xfs_imap_to_bp(mp, bs->cur->bc_tp, &imap, &dip, &bp, 0, 0);
+ if (!xchk_btree_xref_process_error(bs->sc, bs->cur, 0, &error))
+ return 0;
+
+ /* Which inodes are free? */
+ for (clusterino = 0; clusterino < nr_inodes; clusterino++) {
+ error = xchk_iallocbt_check_cluster_freemask(bs, fsino,
+ chunkino, clusterino, irec, bp);
+ if (error)
+ break;
+ }
+
+ xfs_trans_brelse(bs->cur->bc_tp, bp);
+ return error;
+}
+
+/* Make sure the free mask is consistent with what the inodes think. */
+STATIC int
+xchk_iallocbt_check_freemask(
+ struct xchk_btree *bs,
+ struct xfs_inobt_rec_incore *irec)
+{
+ struct xfs_mount *mp = bs->cur->bc_mp;
+ xfs_agino_t agino;
+ int error = 0;
+
+ for (agino = irec->ir_startino;
+ agino < irec->ir_startino + XFS_INODES_PER_CHUNK;
+ agino += mp->m_inodes_per_cluster) {
+ error = xchk_iallocbt_check_cluster(bs, irec, agino);
+ if (error)
+ break;