dabtree.h 1.3 KB

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