blob: 1f3515c6d5a8f2dbc880ffec1bfe6de237787917 [file] [log] [blame]
Dave Chinner0b61f8a2018-06-05 19:42:14 -07001// SPDX-License-Identifier: GPL-2.0+
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -07002/*
3 * Copyright (C) 2017 Oracle. All Rights Reserved.
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -07004 * Author: Darrick J. Wong <darrick.wong@oracle.com>
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -07005 */
6#ifndef __XFS_SCRUB_DABTREE_H__
7#define __XFS_SCRUB_DABTREE_H__
8
9/* dir/attr btree */
10
Darrick J. Wongc517b3a2018-07-19 12:29:11 -070011struct xchk_da_btree {
Darrick J. Wong032d91f2018-07-19 12:29:12 -070012 struct xfs_da_args dargs;
13 xfs_dahash_t hashes[XFS_DA_NODE_MAXDEPTH];
14 int maxrecs[XFS_DA_NODE_MAXDEPTH];
15 struct xfs_da_state *state;
Darrick J. Wong1d8a7482018-07-19 12:29:12 -070016 struct xfs_scrub *sc;
Darrick J. Wong032d91f2018-07-19 12:29:12 -070017 void *private;
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -070018
19 /*
20 * Lowest and highest directory block address in which we expect
21 * to find dir/attr btree node blocks. For a directory this
22 * (presumably) means between LEAF_OFFSET and FREE_OFFSET; for
23 * attributes there is no limit.
24 */
Darrick J. Wong032d91f2018-07-19 12:29:12 -070025 xfs_dablk_t lowest;
26 xfs_dablk_t highest;
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -070027
Darrick J. Wong032d91f2018-07-19 12:29:12 -070028 int tree_level;
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -070029};
30
Christoph Hellwig649d9d92019-11-08 14:52:07 -080031typedef int (*xchk_da_btree_rec_fn)(struct xchk_da_btree *ds, int level);
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -070032
33/* Check for da btree operation errors. */
Darrick J. Wongc517b3a2018-07-19 12:29:11 -070034bool xchk_da_process_error(struct xchk_da_btree *ds, int level, int *error);
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -070035
36/* Check for da btree corruption. */
Darrick J. Wongc517b3a2018-07-19 12:29:11 -070037void xchk_da_set_corrupt(struct xchk_da_btree *ds, int level);
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -070038
Darrick J. Wong032d91f2018-07-19 12:29:12 -070039int xchk_da_btree_hash(struct xchk_da_btree *ds, int level, __be32 *hashp);
Darrick J. Wong1d8a7482018-07-19 12:29:12 -070040int xchk_da_btree(struct xfs_scrub *sc, int whichfork,
Darrick J. Wong032d91f2018-07-19 12:29:12 -070041 xchk_da_btree_rec_fn scrub_fn, void *private);
Darrick J. Wong7c4a07a2017-10-17 21:37:43 -070042
43#endif /* __XFS_SCRUB_DABTREE_H__ */