On Wed, Dec 13, 2017 at 03:58:19PM -0800, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > Create two helper functions to verify the headers of a long format > btree block. We'll use this later for the realtime rmapbt. > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> ..... > +bool > +xfs_btree_lblock_verify( > + struct xfs_buf *bp, > + unsigned int max_recs) > +{ > + struct xfs_mount *mp = bp->b_target->bt_mount; > + struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); > + > + /* numrecs verification */ > + if (be16_to_cpu(block->bb_numrecs) > max_recs) > + return false; > + > + /* sibling pointer verification */ > + if (!block->bb_u.l.bb_leftsib || > + (block->bb_u.l.bb_leftsib != cpu_to_be64(NULLFSBLOCK) && > + !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_leftsib)))) > + return false; > + if (!block->bb_u.l.bb_rightsib || > + (block->bb_u.l.bb_rightsib != cpu_to_be64(NULLFSBLOCK) && > + !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_rightsib)))) XFS_FSB_SANITY_CHECK() is the same thing as xfs_verify_fsbno(), right? Perhaps they should be converted at the same time so we can get rid of XFS_FSB_SANITY_CHECK()? Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html