xref: /openbmc/linux/fs/xfs/scrub/dabtree.h (revision ecc73f8a)
1739a2fe0SDarrick J. Wong // SPDX-License-Identifier: GPL-2.0-or-later
27c4a07a4SDarrick J. Wong /*
3*ecc73f8aSDarrick J. Wong  * Copyright (C) 2017-2023 Oracle.  All Rights Reserved.
4739a2fe0SDarrick J. Wong  * Author: Darrick J. Wong <djwong@kernel.org>
57c4a07a4SDarrick J. Wong  */
67c4a07a4SDarrick J. Wong #ifndef __XFS_SCRUB_DABTREE_H__
77c4a07a4SDarrick J. Wong #define __XFS_SCRUB_DABTREE_H__
87c4a07a4SDarrick J. Wong 
97c4a07a4SDarrick J. Wong /* dir/attr btree */
107c4a07a4SDarrick J. Wong 
11c517b3aaSDarrick J. Wong struct xchk_da_btree {
127c4a07a4SDarrick J. Wong 	struct xfs_da_args	dargs;
137c4a07a4SDarrick J. Wong 	xfs_dahash_t		hashes[XFS_DA_NODE_MAXDEPTH];
147c4a07a4SDarrick J. Wong 	int			maxrecs[XFS_DA_NODE_MAXDEPTH];
157c4a07a4SDarrick J. Wong 	struct xfs_da_state	*state;
161d8a748aSDarrick J. Wong 	struct xfs_scrub	*sc;
1713791d3bSDarrick J. Wong 	void			*private;
187c4a07a4SDarrick J. Wong 
197c4a07a4SDarrick J. Wong 	/*
207c4a07a4SDarrick J. Wong 	 * Lowest and highest directory block address in which we expect
217c4a07a4SDarrick J. Wong 	 * to find dir/attr btree node blocks.  For a directory this
227c4a07a4SDarrick J. Wong 	 * (presumably) means between LEAF_OFFSET and FREE_OFFSET; for
237c4a07a4SDarrick J. Wong 	 * attributes there is no limit.
247c4a07a4SDarrick J. Wong 	 */
257c4a07a4SDarrick J. Wong 	xfs_dablk_t		lowest;
267c4a07a4SDarrick J. Wong 	xfs_dablk_t		highest;
277c4a07a4SDarrick J. Wong 
287c4a07a4SDarrick J. Wong 	int			tree_level;
297c4a07a4SDarrick J. Wong };
307c4a07a4SDarrick J. Wong 
31649d9d98SChristoph Hellwig typedef int (*xchk_da_btree_rec_fn)(struct xchk_da_btree *ds, int level);
327c4a07a4SDarrick J. Wong 
337c4a07a4SDarrick J. Wong /* Check for da btree operation errors. */
34c517b3aaSDarrick J. Wong bool xchk_da_process_error(struct xchk_da_btree *ds, int level, int *error);
357c4a07a4SDarrick J. Wong 
367c4a07a4SDarrick J. Wong /* Check for da btree corruption. */
37c517b3aaSDarrick J. Wong void xchk_da_set_corrupt(struct xchk_da_btree *ds, int level);
387c4a07a4SDarrick J. Wong 
39032d91f9SDarrick J. Wong int xchk_da_btree_hash(struct xchk_da_btree *ds, int level, __be32 *hashp);
401d8a748aSDarrick J. Wong int xchk_da_btree(struct xfs_scrub *sc, int whichfork,
41c517b3aaSDarrick J. Wong 		xchk_da_btree_rec_fn scrub_fn, void *private);
427c4a07a4SDarrick J. Wong 
437c4a07a4SDarrick J. Wong #endif /* __XFS_SCRUB_DABTREE_H__ */
44