2018-06-06 02:42:14 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-10-18 04:37:43 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Oracle. All Rights Reserved.
|
|
|
|
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
|
*/
|
|
|
|
#ifndef __XFS_SCRUB_DABTREE_H__
|
|
|
|
#define __XFS_SCRUB_DABTREE_H__
|
|
|
|
|
|
|
|
/* dir/attr btree */
|
|
|
|
|
2018-07-19 19:29:11 +00:00
|
|
|
struct xchk_da_btree {
|
2018-07-19 19:29:12 +00:00
|
|
|
struct xfs_da_args dargs;
|
|
|
|
xfs_dahash_t hashes[XFS_DA_NODE_MAXDEPTH];
|
|
|
|
int maxrecs[XFS_DA_NODE_MAXDEPTH];
|
|
|
|
struct xfs_da_state *state;
|
2018-07-19 19:29:12 +00:00
|
|
|
struct xfs_scrub *sc;
|
2018-07-19 19:29:12 +00:00
|
|
|
void *private;
|
2017-10-18 04:37:43 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Lowest and highest directory block address in which we expect
|
|
|
|
* to find dir/attr btree node blocks. For a directory this
|
|
|
|
* (presumably) means between LEAF_OFFSET and FREE_OFFSET; for
|
|
|
|
* attributes there is no limit.
|
|
|
|
*/
|
2018-07-19 19:29:12 +00:00
|
|
|
xfs_dablk_t lowest;
|
|
|
|
xfs_dablk_t highest;
|
2017-10-18 04:37:43 +00:00
|
|
|
|
2018-07-19 19:29:12 +00:00
|
|
|
int tree_level;
|
2017-10-18 04:37:43 +00:00
|
|
|
};
|
|
|
|
|
2019-11-08 22:52:07 +00:00
|
|
|
typedef int (*xchk_da_btree_rec_fn)(struct xchk_da_btree *ds, int level);
|
2017-10-18 04:37:43 +00:00
|
|
|
|
|
|
|
/* Check for da btree operation errors. */
|
2018-07-19 19:29:11 +00:00
|
|
|
bool xchk_da_process_error(struct xchk_da_btree *ds, int level, int *error);
|
2017-10-18 04:37:43 +00:00
|
|
|
|
|
|
|
/* Check for da btree corruption. */
|
2018-07-19 19:29:11 +00:00
|
|
|
void xchk_da_set_corrupt(struct xchk_da_btree *ds, int level);
|
2017-10-18 04:37:43 +00:00
|
|
|
|
2018-07-19 19:29:12 +00:00
|
|
|
int xchk_da_btree_hash(struct xchk_da_btree *ds, int level, __be32 *hashp);
|
2018-07-19 19:29:12 +00:00
|
|
|
int xchk_da_btree(struct xfs_scrub *sc, int whichfork,
|
2018-07-19 19:29:12 +00:00
|
|
|
xchk_da_btree_rec_fn scrub_fn, void *private);
|
2017-10-18 04:37:43 +00:00
|
|
|
|
|
|
|
#endif /* __XFS_SCRUB_DABTREE_H__ */
|