diff options
author | Christoph Hellwig <hch@lst.de> | 2019-11-08 14:52:07 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-11-10 16:54:19 -0800 |
commit | 649d9d98c60ec5e76e2a3c010f21667746765e9c (patch) | |
tree | c091fd268a09ab96f46971b1a84cf7f17abb1b24 /fs/xfs/scrub/dir.c | |
parent | b16be561876ed9b72dcb2bf8c48b30f573f63c1c (diff) |
xfs: refactor btree node scrubbing
Break up xchk_da_btree_entry and handle looking up leaf node entries
in the attr / dir callbacks, so that only the generic node handling
is left in the common core code. Note that the checks for the crc
enabled blocks are removed, as the scrubbing code already remaps the
magic numbers earlier.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/scrub/dir.c')
-rw-r--r-- | fs/xfs/scrub/dir.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c index dca5f159f82a..19e1aae92a75 100644 --- a/fs/xfs/scrub/dir.c +++ b/fs/xfs/scrub/dir.c @@ -182,14 +182,14 @@ out: STATIC int xchk_dir_rec( struct xchk_da_btree *ds, - int level, - void *rec) + int level) { + struct xfs_da_state_blk *blk = &ds->state->path.blk[level]; struct xfs_mount *mp = ds->state->mp; - struct xfs_dir2_leaf_entry *ent = rec; struct xfs_inode *dp = ds->dargs.dp; struct xfs_dir2_data_entry *dent; struct xfs_buf *bp; + struct xfs_dir2_leaf_entry *ent; char *p, *endp; xfs_ino_t ino; xfs_dablk_t rec_bno; @@ -201,6 +201,12 @@ xchk_dir_rec( unsigned int tag; int error; + ASSERT(blk->magic == XFS_DIR2_LEAF1_MAGIC || + blk->magic == XFS_DIR2_LEAFN_MAGIC); + + ent = (void *)ds->dargs.dp->d_ops->leaf_ents_p(blk->bp->b_addr) + + (blk->index * sizeof(struct xfs_dir2_leaf_entry)); + /* Check the hash of the entry. */ error = xchk_da_btree_hash(ds, level, &ent->hashval); if (error) |