^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2017 Oracle. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Darrick J. Wong <darrick.wong@oracle.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef __XFS_SCRUB_DABTREE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __XFS_SCRUB_DABTREE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) /* dir/attr btree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct xchk_da_btree {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct xfs_da_args dargs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) xfs_dahash_t hashes[XFS_DA_NODE_MAXDEPTH];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) int maxrecs[XFS_DA_NODE_MAXDEPTH];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct xfs_da_state *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct xfs_scrub *sc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) void *private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * Lowest and highest directory block address in which we expect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * to find dir/attr btree node blocks. For a directory this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * (presumably) means between LEAF_OFFSET and FREE_OFFSET; for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * attributes there is no limit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) xfs_dablk_t lowest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) xfs_dablk_t highest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int tree_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) typedef int (*xchk_da_btree_rec_fn)(struct xchk_da_btree *ds, int level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* Check for da btree operation errors. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) bool xchk_da_process_error(struct xchk_da_btree *ds, int level, int *error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* Check for da btree corruption. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void xchk_da_set_corrupt(struct xchk_da_btree *ds, int level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int xchk_da_btree_hash(struct xchk_da_btree *ds, int level, __be32 *hashp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int xchk_da_btree(struct xfs_scrub *sc, int whichfork,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) xchk_da_btree_rec_fn scrub_fn, void *private);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #endif /* __XFS_SCRUB_DABTREE_H__ */